本文整理汇总了PHP中email_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP email_exists函数的具体用法?PHP email_exists怎么用?PHP email_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了email_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_create_user
public function json_create_user()
{
$error = array("status" => 0, "msg" => __('There has been an error processing your request. Please, reload the page and try again.', Eab_EventsHub::TEXT_DOMAIN));
$data = stripslashes_deep($_POST);
$email = $data['email'];
if (empty($email)) {
$error['msg'] = __('Please, submit an email.', Eab_EventsHub::TEXT_DOMAIN);
die(json_encode($error));
}
if (!is_email($email)) {
$error['msg'] = __('Please, submit a valid email.', Eab_EventsHub::TEXT_DOMAIN);
die(json_encode($error));
}
if (email_exists($email)) {
$current_location = get_permalink();
if (!empty($data['location'])) {
// Let's make this sane first - it's coming from a POST request, so make that sane
$loc = wp_validate_redirect(wp_sanitize_redirect($data['location']));
if (!empty($loc)) {
$current_location = $loc;
}
}
$login_link = wp_login_url($current_location);
$login_message = sprintf(__('The email address already exists. Please <a href="%s">Login</a> and RSVP to the event.', Eab_EventsHub::TEXT_DOMAIN), $login_link);
$error['msg'] = $login_message;
die(json_encode($error));
}
$wordp_user = $this->_create_user($email);
if (is_object($wordp_user) && !empty($wordp_user->ID)) {
$this->_login_user($wordp_user);
} else {
die(json_encode($error));
}
die(json_encode(array("status" => 1)));
}
示例2: ct_validate_email_ajaxlogin
function ct_validate_email_ajaxlogin($email = null, $is_ajax = true)
{
require_once CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php';
global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done, $ct_formtime_label, $ct_negative_comment, $ct_options, $ct_data;
$ct_options = ct_get_options();
$ct_data = ct_get_data();
$email = is_null($email) ? $email : $_POST['email'];
$email = sanitize_email($email);
$is_good = true;
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email)) {
$is_good = false;
}
if (class_exists('AjaxLogin') && isset($_POST['action']) && $_POST['action'] == 'validate_email') {
$ct_options = ct_get_options();
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
$submit_time = submit_time_test();
$sender_info = get_sender_info();
$sender_info['post_checkjs_passed'] = $checkjs;
if ($checkjs === null) {
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
$sender_info['cookie_checkjs_passed'] = $checkjs;
}
$sender_info = json_encode($sender_info);
if ($sender_info === false) {
$sender_info = '';
}
require_once 'cleantalk.class.php';
$config = get_option('cleantalk_server');
$ct = new Cleantalk();
$ct->work_url = $config['ct_work_url'];
$ct->server_url = $ct_options['server'];
$ct->server_ttl = $config['ct_server_ttl'];
$ct->server_changed = $config['ct_server_changed'];
$ct->ssl_on = $ct_options['ssl_on'];
$ct_request = new CleantalkRequest();
$ct_request->auth_key = $ct_options['apikey'];
$ct_request->sender_email = $email;
$ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
$ct_request->sender_nickname = '';
$ct_request->agent = $ct_agent_version;
$ct_request->sender_info = $sender_info;
$ct_request->js_on = $checkjs;
$ct_request->submit_time = $submit_time;
$ct_result = $ct->isAllowUser($ct_request);
if ($ct->server_change) {
update_option('cleantalk_server', array('ct_work_url' => $ct->work_url, 'ct_server_ttl' => $ct->server_ttl, 'ct_server_changed' => time()));
}
if ($ct_result->allow === 0) {
$is_good = false;
}
}
if ($is_good) {
$ajaxresult = array('description' => null, 'cssClass' => 'noon', 'code' => 'success');
} else {
$ajaxresult = array('description' => 'Invalid Email', 'cssClass' => 'error-container', 'code' => 'error');
}
$ajaxresult = json_encode($ajaxresult);
print $ajaxresult;
wp_die();
}
示例3: registrar_usuario
function registrar_usuario($parametros)
{
$errors = new WP_Error();
if ($parametros['email'] == NULL) {
$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
return $errors;
}
if (!es_email($parametros['email'])) {
$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.'));
return $errors;
}
if (email_exists($parametros['email'])) {
$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
return $errors;
}
if ($parametros['nombre'] == NULL) {
$errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
return $errors;
}
$user_pass = $parametros['clave'] == NULL ? wp_generate_password(12, false) : $parametros['clave'];
$user_id = wp_create_user($parametros['email'], $user_pass, $parametros['email']);
if (!$user_id) {
$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
return $errors;
}
update_user_option($user_id, 'default_password_nag', true, true);
//Set up the Password change nag.
wp_new_user_notification($user_id, $user_pass);
// Actualización de tabla clientes...
return $user_id;
}
示例4: fu_add_new_user
function fu_add_new_user($fu = false)
{
//echo "wtf?";
require_once '../../../wp-includes/registration.php';
global $blog_id;
$email = sanitize_email($fu['email']);
//$current_site = get_current_site();
$pass = $fu['password'];
$user_id = email_exists($email);
//echo "hi";
if (!$user_id) {
$password = $pass ? $pass : generate_random_password();
$user_id = wpmu_create_user($fu['username'], $password, $email);
if (false == $user_id) {
//echo "uh oh";
wp_die(__('There was an error creating the user'));
} else {
//echo "sending mail";
wp_new_user_notification($user_id, $password);
}
if (get_user_option('primary_blog', $user_id) == $blog_id) {
update_user_option($user_id, 'primary_blog', $blog_id, true);
}
}
$redirect = $fu['referer'] ? $fu['referer'] : get_bloginfo('url');
wp_redirect($redirect);
}
示例5: registra_usuario
function registra_usuario($username, $password, $email)
{
global $db;
if (user_exists($username)) {
$mensaje_de_error = "El usuario " . $username . " ya existe";
} else {
if (check_email($email) == 0) {
$mensaje_de_error = "El mail no es válido";
} else {
if (email_exists($email)) {
$mensaje_de_error = "El mail " . $email . " ya existe";
} else {
$SELECT = "INSERT INTO usuarios ( usuario_login, usuario_password, usuario_email, usuario_nombre )";
$SELECT .= " VALUES ( '" . $username . "', '" . md5($password) . "', '" . $email . "', '" . $username . "' )";
$result = $db->get_results($SELECT);
logea("registro " . $username, "", $_SESSION["usuario"]);
//Creamos el ranking con un día atrás para que no obtenga beneficios de 60000 al actualizar el ranking hoy
$SELECT = "INSERT INTO ranking ( ranking_usuario, ranking_saldo, ranking_invertido, ranking_total, ranking_beneficio_hoy, ranking_fecha ) ";
$SELECT .= " VALUES ( '" . $username . "', '60000', '0', '60000', '0', CURDATE()-INTERVAL 1 DAY )";
$result = $db->get_results($SELECT);
}
}
}
return $mensaje_de_error;
}
示例6: __user_exists_check
private function __user_exists_check($data)
{
// check if user exists in WP or DB
$return = array('user' => false);
if (isset($data['user_email'])) {
$email_check = email_exists($data['user_email']);
if ($email_check) {
$db_user = $this->__user_db_check($data['social_id']);
if (!$db_user) {
$this->__create_user_db($email_check, $data['social_id']);
}
$return['user'] = get_user_by('id', $email_check);
}
}
if (isset($data['social_id']) && $return['user'] == false) {
$db_user = $this->__user_db_check($data['social_id']);
if ($db_user) {
$return['user'] = get_user_by('id', $db_user->wp_user_id);
}
}
if (!isset($data['social_id']) && !isset($data['user_email'])) {
return new WP_Error('No Data', __('Expecting social_id or user_email'), array('status' => 400));
}
return $return;
}
示例7: is_email_does_not_exist
/** Return true if supplied email is valid or give an error message otherwise */
static function is_email_does_not_exist($e)
{
if (email_exists($e)) {
return __('Já existe um usuário com o e-mail informado');
}
return true;
}
示例8: get_user_date
/**
* Return user data in JSON format
*
* @todo add hooks to accomodate different user values
* @since 3.0
*
*/
function get_user_date($user_email = false) {
global $wpdb;
if(!$user_email) {
return;
}
$user_id = email_exists($user_email);
if(!$user_id) {
return;
}
$user_data['first_name'] = get_user_meta($user_id, 'first_name', true);
$user_data['last_name'] = get_user_meta($user_id, 'last_name', true);
$user_data['company_name'] = get_user_meta($user_id, 'company_name', true);
$user_data['phonenumber'] = get_user_meta($user_id, 'phonenumber', true);
$user_data['streetaddress'] = get_user_meta($user_id, 'streetaddress', true);
$user_data['city'] = get_user_meta($user_id, 'city', true);
$user_data['state'] = get_user_meta($user_id, 'state', true);
$user_data['zip'] = get_user_meta($user_id, 'zip', true);
if($user_data) {
echo json_encode(array('succes' => 'true', 'user_data' => $user_data));
}
}
示例9: registration_validation
function registration_validation($username, $password, $email)
{
global $reg_errors;
$reg_errors = new WP_Error();
if (empty($username) || empty($password) || empty($email)) {
$reg_errors->add('field', 'Required form field is missing');
}
if (4 > strlen($username)) {
$reg_errors->add('username_length', 'Username too short. At least 4 characters is required');
}
if (username_exists($username)) {
$reg_errors->add('user_name', 'Sorry, that username already exists!');
}
if (!validate_username($username)) {
$reg_errors->add('username_invalid', 'Sorry, the username you entered is not valid');
}
if (5 > strlen($password)) {
$reg_errors->add('password', 'Password length must be greater than 5');
}
if (!is_email($email)) {
$reg_errors->add('email_invalid', 'Email is not valid');
}
if (email_exists($email)) {
$reg_errors->add('email', 'Email Already in use');
}
if (is_wp_error($reg_errors)) {
foreach ($reg_errors->get_error_messages() as $error) {
echo '<div>';
echo '<strong>ERROR</strong>:';
echo $error . '<br/>';
echo '</div>';
}
}
}
示例10: upme_replace_avatar
function upme_replace_avatar($avatar, $id_or_email, $size, $default, $alt)
{
// Optimized condition and added strict conditions
if (is_numeric($id_or_email)) {
$user_id = $id_or_email;
} else {
if (is_object($id_or_email)) {
$user_id = email_exists($id_or_email->comment_author_email);
} else {
$user_id = email_exists($id_or_email);
}
}
echo '<pre>';
print_r($user_id);
echo '</pre>';
exit;
// Filter default gravatars to prvent the loading of custom profile image
$default_gravatars = array("blank", "identicon", "wavatar", "monsterid", "retro");
if ($user_id > 0 && !in_array($default, $default_gravatars)) {
if (get_the_author_meta('user_pic', $user_id) != '') {
if (!isset($size) || $size == '0') {
$size = 60;
}
$avatar = '<img src="' . get_the_author_meta('user_pic', $user_id) . '" alt="" width="' . $size . '" height="' . $size . '" class="avatar avatar-' . $size . ' photo">';
}
}
/* UPME Filter for customizing avatar image on profiles */
$avatar = apply_filters('upme_replace_avatar', $avatar, $user_id);
// End Filter
return $avatar;
}
示例11: pn_create_user
function pn_create_user($user_name, $user_email, $first_name, $last_name, $title)
{
require_once ABSPATH . WPINC . '/pluggable.php';
//WP v3.0.1 - wp_generate_password
require_once ABSPATH . WPINC . '/registration.php';
//WP v3.0.1 - username_exists, email_exists
if (email_exists($user_email)) {
return false;
}
$user_id = username_exists($user_name);
if (!$user_id) {
$random_password = wp_generate_password(12, false);
$user_role = get_option('pn_register_role') ? get_option('pn_register_role') : 'subscriber';
$new_user = array();
$new_user['user_pass'] = $random_password;
$new_user['user_login'] = $user_name;
$new_user['user_email'] = $user_email;
$new_user['display_name'] = $title . ' ' . $first_name . ' ' . $last_name;
$new_user['first_name'] = $first_name;
$new_user['last_name'] = $last_name;
$new_user['role'] = $user_role;
if ($id = wp_insert_user($new_user)) {
return $random_password;
} else {
return false;
}
} else {
return false;
}
}
示例12: mdjm_add_client_ajax
/**
* Adds a new client from the event field.
*
* @since 1.3.7
* @global arr $_POST
*/
function mdjm_add_client_ajax()
{
$client_id = false;
$client_list = '';
$result = array();
$message = array();
if (!is_email($_POST['client_email'])) {
$message[] = __('Email address is invalid', 'mobile-dj-manager');
} elseif (email_exists($_POST['client_email'])) {
$message[] = __('Email address is already in use', 'mobile-dj-manager');
} else {
$user_data = array('first_name' => ucwords($_POST['client_firstname']), 'last_name' => !empty($_POST['client_lastname']) ? ucwords($_POST['client_lastname']) : '', 'user_email' => $_POST['client_email'], 'client_phone' => !empty($_POST['client_phone']) ? $_POST['client_phone'] : '', 'client_phone2' => !empty($_POST['client_phone2']) ? $_POST['client_phone2'] : '');
$user_data = apply_filters('mdjm_event_new_client_data', $user_data);
$client_id = mdjm_add_client($user_data);
}
$clients = mdjm_get_clients('client');
if (!empty($clients)) {
foreach ($clients as $client) {
$client_list .= sprintf('<option value="%1$s"%2$s>%3$s</option>', $client->ID, $client->ID == $client_id ? ' selected="selected"' : '', $client->display_name);
}
}
if (empty($client_id)) {
$result = array('type' => 'error', 'message' => explode("\n", $message));
} else {
$result = array('type' => 'success', 'client_id' => $client_id, 'client_list' => $client_list);
do_action('mdjm_after_add_new_client', $user_data);
}
echo json_encode($result);
die;
}
示例13: main
/**
* Mot de passe oublié (partie 1)
* @author Cam
* @return tpl
*/
protected function main()
{
// Si le membre est déjà connecté
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, './');
}
$this->set_title(Nw::$lang['users']['title_lost_pwd']);
$this->set_tpl('membres/oubli_mdp.html');
$this->add_css('forms.css');
// Fil ariane
$this->set_filAriane(Nw::$lang['users']['title_lost_pwd']);
//Si le formulaire a été validé
if (isset($_POST['submit'])) {
// Cette adresse email existe bien sur le site
inc_lib('users/email_exists');
if (email_exists($_POST['mail'])) {
//On récupère les infos du membre
inc_lib('users/get_info_mbr');
$membre_mail = get_info_mbr($_POST['mail'], 'mail');
$lien_password = Nw::$site_url . 'users-13.html?idm=' . $membre_mail['u_id'] . '&ca=' . $membre_mail['u_code_act'];
//On prépare le texte de l'email
$txt_mail = sprintf(Nw::$lang['users']['mail_oubli_pwd'], $membre_mail['u_pseudo'], $lien_password, $lien_password, $lien_password);
@envoi_mail(trim($_POST['mail']), sprintf(Nw::$lang['users']['title_mail_lost_pwd'], Nw::$site_name), $txt_mail);
redir(Nw::$lang['users']['send_mail_lost'], true, './');
} else {
redir(Nw::$lang['users']['email_aucun_mbr'], false, 'users-12.html');
}
}
}
示例14: getAvatar
/**
* Filter for get_avatar. Allow to change degault avatar to custom one.
*
* @param type $avatar
* @param type $id_or_email
* @param type $size
* @param type $default
* @param type $alt
* @return html img tag
*/
function getAvatar($avatar = '', $id_or_email, $size = '96', $default = '', $alt = false)
{
global $userMeta;
$safe_alt = false === $alt ? '' : esc_attr($alt);
if (is_numeric($id_or_email)) {
$user_id = (int) $id_or_email;
} elseif (is_string($id_or_email)) {
$user_id = email_exists($id_or_email);
} elseif (is_object($id_or_email)) {
if (!empty($id_or_email->user_id)) {
$user_id = (int) $id_or_email->user_id;
} elseif (!empty($id_or_email->comment_author_email)) {
$user_id = email_exists($id_or_email->comment_author_email);
}
}
if (!isset($user_id)) {
return $avatar;
}
$umAvatar = get_user_meta($user_id, 'user_avatar', true);
$file = $userMeta->determinFileDir($umAvatar);
if (!empty($file)) {
$avatar = "<img alt='{$safe_alt}' src='{$file['url']}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
}
return $avatar;
}
示例15: seed_cspv4_emaillist_followupemails_queue_email
function seed_cspv4_emaillist_followupemails_queue_email()
{
global $wpdb, $seed_cspv4, $seed_cspv4_post_result;
extract($seed_cspv4);
require_once SEED_CSPV4_PLUGIN_PATH . 'lib/nameparse.php';
$name = '';
if (!empty($_REQUEST['name'])) {
$name = $_REQUEST['name'];
}
$email = strtolower($_REQUEST['email']);
$fname = '';
$lname = '';
if (!empty($name)) {
$name = seed_cspv4_parse_name($name);
$fname = $name['first'];
$lname = $name['last'];
}
if (email_exists($email)) {
// Subscriber already exist show stats
$seed_cspv4_post_result['status'] = '200';
$seed_cspv4_post_result['msg'] = $txt_already_subscribed_msg;
$seed_cspv4_post_result['msg_class'] = 'alert-info';
$seed_cspv4_post_result['clicks'] = '0';
} else {
$user_id = wp_insert_user(array('user_login' => $email, 'user_email' => $email, 'first_name' => $fname, 'last_name' => $lname, 'user_pass' => wp_generate_password()));
if (empty($seed_cspv4_post_result['status'])) {
$seed_cspv4_post_result['status'] = '200';
}
}
}