当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_new_user_notification函数代码示例

本文整理汇总了PHP中wp_new_user_notification函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_new_user_notification函数的具体用法?PHP wp_new_user_notification怎么用?PHP wp_new_user_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_new_user_notification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_usuario_cuervo

/**
 * Crear un nuevo usuario
 * @param  string $user username
 */
function create_usuario_cuervo($user)
{
    $password = wp_generate_password();
    $user_id = wp_create_user($user, $password, "{$user}@pcuervo.com");
    if (is_int($user_id)) {
        set_cuervo_role($user_id);
        wp_new_user_notification($user_id, $password);
    }
}
开发者ID:kamilik26,项目名称:aiesec,代码行数:13,代码来源:users.php

示例2: userRegister

 function userRegister()
 {
     $this->verifyNonce('userRegister');
     $data = $_POST["data"];
     $userID = wp_insert_user(array('first_name' => $data["first_name"], 'last_name' => $data["last_name"], 'nickname' => $data["nickname"], 'user_email' => $data["user_email"], 'user_login' => $data["user_login"], 'user_pass' => $data["user_pass"]));
     /*
     	Add a custom capability to the user
     		$user = new WP_User($userID);
     		$user->add_cap("edit_posts");
     		$user->add_cap("delete_posts");
     */
     if (isset($userID->errors)) {
         echo json_encode($userID);
     } else {
         //Add USER INFO
         add_user_meta($userID, "adress", $data["adress"], true);
         add_user_meta($userID, "localidade", $data["localidade"], true);
         add_user_meta($userID, "codPostal", $data["codPostal"], true);
         add_user_meta($userID, "treinador", "Não atribuido", true);
         //Notify user and admin that a new user arrived
         wp_new_user_notification($userID, '', 'both');
         echo '{"userID": "' . $userID . '"}';
     }
     wp_die();
 }
开发者ID:eralha,项目名称:wp_angular_base,代码行数:25,代码来源:ajax__calls.php

示例3: add_new_employer

 function add_new_employer($postdata)
 {
     if (isset($postdata['employer_id']) && !empty($postdata['employer_id'])) {
         $user_id = $postdata['employer_id'];
         $this->update_empoyer($user_id, $postdata);
         return $user_id;
     }
     $validate = $this->new_admin_form_validate($postdata);
     if (is_wp_error($validate)) {
         return $validate;
     }
     $random_password = wp_generate_password(8, false);
     $first_name = sanitize_text_field($postdata['first_name']);
     $last_name = sanitize_text_field($postdata['last_name']);
     $display_name = $first_name . ' ' . $last_name;
     $userdata = array('user_login' => $postdata['user_name'], 'user_pass' => $random_password, 'user_email' => $postdata['email'], 'first_name' => $first_name, 'last_name' => $last_name, 'display_name' => $display_name, 'role' => 'hrm_employee');
     $user_id = wp_insert_user($userdata);
     if ($user_id) {
         update_user_meta($user_id, '_hrm_user_role', 'hrm_employee');
         $this->update_empoyer($user_id, $postdata);
         wp_new_user_notification($user_id, $random_password);
         return $user_id;
     } else {
         return false;
     }
 }
开发者ID:Ejeus,项目名称:Human-Resource-Management-hrm,代码行数:26,代码来源:employeelist.php

示例4: create

 /**
  * Creates a patchchat post by
  *   creating a user,
  *   creating a new patchchat post,
  *   creating first comment to post,
  *   adding an 'instant reply' comment from admin,
  *   building a new transient,
  *   return new transient to new user
  *
  * @author  caseypatrickdriscoll
  *
  * @edited 2015-08-03 16:32:16 - Adds user signon after creation
  * @edited 2015-08-28 20:11:39 - Adds PatchChat_Settings::instant_reply
  * @edited 2015-08-28 20:19:22 - Adds PatchChat_Settings::bot
  */
 public static function create($patchchat)
 {
     $email = $patchchat['email'];
     $text = $patchchat['text'];
     $username = substr($email, 0, strpos($email, "@"));
     $password = wp_generate_password(10, false);
     $title = substr($text, 0, 40);
     $time = current_time('mysql');
     $text = wp_strip_all_tags($text);
     /* Create User */
     $user_id = wp_create_user($username, $password, $email);
     // TODO: Add the user's name to the user
     // TODO: Check to see if user logged in, no need to create again
     wp_new_user_notification($user_id, $password);
     $user = get_user_by('id', $user_id);
     $creds = array('user_login' => $user->user_login, 'user_password' => $password, 'remember' => true);
     $user_signon = wp_signon($creds, false);
     /* Create PatchChat Post */
     $post = array('post_title' => $title, 'post_type' => 'patchchat', 'post_author' => $user_id, 'post_status' => 'new', 'post_date' => $time);
     $post_id = wp_insert_post($post);
     /* Create First Comment */
     $comment = array('comment_post_ID' => $post_id, 'user_id' => $user_id, 'comment_content' => $text, 'comment_date' => $time, 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => $_SERVER['HTTP_USER_AGENT']);
     $comment_id = wp_insert_comment($comment);
     /* Insert default action comment reply */
     $options = array('chatid' => $post_id, 'displayname' => $user->display_name);
     $comment = array('comment_post_ID' => $post_id, 'user_id' => PatchChat_Settings::bot(), 'comment_content' => PatchChat_Settings::instant_reply($options), 'comment_type' => 'auto', 'comment_date' => current_time('mysql'));
     $comment_id = wp_insert_comment($comment);
     // Will build the Transient
     PatchChat_Transient::get($post_id);
     return PatchChat_Controller::get_user_state($user_id);
 }
开发者ID:patchdotworks,项目名称:patchchat,代码行数:46,代码来源:class-patchchat-controller.php

示例5: process_registration

 public function process_registration()
 {
     do_action('popmake_alm_ajax_override_registration');
     $user_login = $_POST['user_login'];
     $user_email = $_POST['user_email'];
     $user_pass = isset($_POST['user_pass']) ? $_POST['user_pass'] : wp_generate_password(12, false);
     $userdata = compact('user_login', 'user_email', 'user_pass');
     $user = wp_insert_user($userdata);
     if (!isset($_POST['user_pass'])) {
         update_user_option($user, 'default_password_nag', true, true);
         // Set up the Password change nag.
         wp_new_user_notification($user, $user_pass);
     }
     if (is_wp_error($user)) {
         $response = array('success' => false, 'message' => $user->get_error_message());
     } else {
         if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) {
             $creds = array('user_login' => $user_login, 'user_password' => $user_pass, 'remember' => true);
             $user = wp_signon($creds);
         }
         $message = __('Registration complete.', 'popup-maker-ajax-login-modals');
         if (!isset($_POST['user_pass'])) {
             $message .= ' ' . __('Please check your e-mail.', 'popup-maker-ajax-login-modals');
         }
         $response = array('success' => true, 'message' => $message);
     }
     echo json_encode($response);
     die;
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:29,代码来源:class-ajax.php

示例6: 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);
}
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:27,代码来源:front-users.php

示例7: user_register

 public function user_register()
 {
     global $wpdb;
     $data = $_POST;
     $login_data = array();
     $resp = new ajax_response($data['action'], true);
     $code_data = $wpdb->get_results('SELECT * FROM ' . $wpdb->register_codes . ' WHERE 1=1 AND register_code == ' . $wpdb->escape($data['sec_code']));
     if ($code_data->register_code_used == 0) {
         $username = $wpdb->escape($data['user_name']);
         $exists = username_exists($username);
         if (!$exists) {
             $user_id = wp_create_user($username, wp_generate_password($length = 12, $include_standard_special_chars = false), $username);
             wp_new_user_notification($user_id, null, true);
             if (!is_wp_error($user_id)) {
                 $user = get_user_by('id', $user_id);
                 $wpdb->update($wpdb->register_codes, array('register_code_used' => 1, 'register_code_used_by' => $user->data->user_login), array('register_code' => $wpdb->escape($data['sec_code'])));
                 $resp->set_status(true);
                 $resp->set_message($user->data->user_login . ' is successfully registered. Please switch to the login tab to login.');
             } else {
                 foreach ($user_id->errors as $k => $error) {
                     $resp->set_message(array($error[0]));
                 }
             }
         } else {
             $resp->set_message('User already exists. Please use a different email address.');
         }
     } else {
         $resp->set_message('Security token not recognized. Could not register you without a valid security token.');
     }
     echo $resp->encode_response();
     die;
 }
开发者ID:TrevorMW,项目名称:wp-lrsgen,代码行数:32,代码来源:class-custom-login.php

示例8: 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&#8217;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&#8217;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;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:31,代码来源:acciones.php

示例9: notify

 /**
  * Send registration notification to the user
  * @param  string $user_id         user id number
  * @param  string $random_password plain text password
  * @return void
  */
 public static function notify($user_id, $random_password)
 {
     // Send registration notification
     // Note: this function accepts 2 parameters because
     // we're using the WP User Manager plugin.
     // WP default function uses 3 parameters and cannot be used in this way.
     wp_new_user_notification($user_id, $random_password);
 }
开发者ID:alessandrotesoro,项目名称:envato-login,代码行数:14,代码来源:class-wpel-user.php

示例10: dc_add_new_dreamer

function dc_add_new_dreamer()
{
    if (isset($_POST["dc_user_email"]) && wp_verify_nonce($_POST['dc_register_nonce'], 'dc-register-nonce')) {
        $user_login = $_POST["dc_user_email"];
        $user_email = $_POST["dc_user_email"];
        $user_first = $_POST["dc_user_first"];
        $user_last = $_POST["dc_user_last"];
        //$user_pass    = $_POST["dc_user_pass"];
        //$pass_confirm   = $_POST["dc_user_pass_confirm"];
        // this is required for username checks
        // require_once(ABSPATH . WPINC . '/registration.php');
        // if(username_exists($user_login)) {
        //   // Username already registered
        //   dc_errors()->add('username_unavailable', __('Username already taken'));
        // }
        // if(!validate_username($user_login)) {
        //   // invalid username
        //   dc_errors()->add('username_invalid', __('Invalid username'));
        // }
        // if($user_login == '') {
        //   // empty username
        //   dc_errors()->add('username_empty', __('Please enter a username'));
        // }
        // if(!is_email($user_email)) {
        //   //invalid email
        //   dc_errors()->add('email_invalid', __('Invalid email'));
        // }
        // if(email_exists($user_email)) {
        //   //Email address already registered
        //   dc_errors()->add('email_used', __('Email already registered'));
        // }
        //if($user_pass == '') {
        // passwords do not match
        // dc_errors()->add('password_empty', __('Please enter a password'));
        //}
        //if($user_pass != $pass_confirm) {
        // passwords do not match
        //dc_errors()->add('password_mismatch', __('Passwords do not match'));
        //}
        // $errors = dc_errors()->get_error_messages();
        $errors = '';
        // only create the user in if there are no errors
        if (empty($errors)) {
            $new_user_id = wp_insert_user(array('user_login' => $user_login, 'user_pass' => $user_pass, 'user_email' => $user_email, 'first_name' => $user_first, 'last_name' => $user_last, 'user_registered' => date('Y-m-d H:i:s'), 'role' => 'dreamer'));
            if ($new_user_id) {
                // send an email to the admin alerting them of the registration
                wp_new_user_notification($new_user_id, '', 'both');
                // log the new user in
                //wp_setcookie($user_login, $user_pass, true);
                //wp_set_current_user($new_user_id, $user_login);
                //do_action('wp_login', $user_login);
                // send the newly created user to the home page after logging them in and add a confirmation message
                wp_redirect(home_url());
                exit;
            }
        }
    }
}
开发者ID:0dp,项目名称:dreamcity,代码行数:58,代码来源:processing.php

示例11: mailNewAffiliate

 public function mailNewAffiliate($user_id, $user_pass)
 {
     //#62 piggyback onto the username / password email
     add_filter('wp_mail', array($this, 'filterMail'));
     add_filter('wp_mail_from', array($this, 'filterMailAddress'));
     add_filter('wp_mail_from_name', array($this, 'filterMailName'));
     wp_new_user_notification($user_id, $user_pass);
     remove_filter('wp_mail', array($this, 'filterMail'));
     remove_filter('wp_mail_from', array($this, 'filterMailAddress'));
     remove_filter('wp_mail_from_name', array($this, 'filterMailName'));
 }
开发者ID:hizamomar,项目名称:affiliates-manager-plugin,代码行数:11,代码来源:EmailHandler.php

示例12: successRegistration

 protected function successRegistration($values)
 {
     $errors = wp_create_user($values['email'], $values['password'], $values['email']);
     wp_update_user(array('ID' => $errors, 'first_name' => $values['firstname'], 'last_name' => $values['lastname']));
     add_user_meta($errors, '_sln_phone', $values['phone']);
     add_user_meta($errors, '_sln_address', $values['address']);
     if (is_wp_error($errors)) {
         $this->addError($errors->get_error_message());
     }
     wp_new_user_notification($errors, $values['password']);
     if (!$this->dispatchAuth($values['email'], $values['password'])) {
         $this->bindValues($values);
         return false;
     }
 }
开发者ID:udaykanthgummadi,项目名称:salon-booking-system,代码行数:15,代码来源:AbstractUserStep.php

示例13: send_registration_notification

 private function send_registration_notification($user_id, $username, $email, $password)
 {
     wp_new_user_notification($user_id);
     $username = stripslashes($username);
     $password = stripslashes($password);
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $title = apply_filters('wpsc_registration_notification_title', __('[%s] Thank you for registering', 'wpsc'));
     $title = sprintf($title, $blogname);
     $message = sprintf(__('Welcome, %s.', 'wpsc'), $username) . "\r\n\r\n";
     $message .= __("Thank you for registering with us. Your account has been created:", 'wpsc') . "\r\n\r\n";
     $message .= sprintf(__('Username: %s', 'wpsc'), $username) . "\r\n\r\n";
     $message .= sprintf(__('Password: %s', 'wpsc'), $password) . "\r\n\r\n";
     $message .= __("Here's a list of things you can do to get started:", 'wpsc') . "\r\n\r\n";
     $message .= sprintf(__('1. Log in with your new account details <%s>', 'wpsc'), wpsc_get_login_url()) . "\r\n\r\n";
     $message .= sprintf(__('2. Build your customer profile, and probably change your password to something easier to remember <%s>', 'wpsc'), wpsc_get_customer_account_url()) . "\r\n\r\n";
     $message .= sprintf(__('3. Explore our shop! <%s>', 'wpsc'), wpsc_get_store_url()) . "\r\n\r\n";
     $message = apply_filters('wpsc_registration_notification_body', $message);
     wp_mail($email, $title, $message);
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:19,代码来源:register.php

示例14: validation

 /**
  * Validate the data and insert the user.
  *
  * @param array $validation_result The results.
  * @return mixed
  * @throws \Exception
  */
 public static function validation($validation_result)
 {
     $valid_args = ['user_login', 'user_pass', 'user_email', 'display_name', 'first_name', 'last_name'];
     $form = $validation_result['form'];
     $args = [];
     $errors = [];
     foreach ($valid_args as $arg) {
         $value = Utils::get_field_value($form, $arg);
         if (false !== $value) {
             $args[$arg] = $value;
         }
     }
     if (!(isset($args['user_email']) && isset($args['user_pass']))) {
         throw new \Exception('The signup form must have user_email and user_pass fields.');
     }
     $errors['user_email'] = Validate::email($args['user_email']);
     $errors['user_pass'] = Validate::password($args['user_pass']);
     if (array_filter($errors)) {
         // There's an error in a specific field if we get here.
         foreach ($form['fields'] as &$field) {
             if (isset($errors[$field->adminLabel]) && $errors[$field->adminLabel]) {
                 $field->validation_message = $errors[$field->adminLabel];
                 $field->failed_validation = true;
             }
         }
         $validation_result['is_valid'] = false;
         return $validation_result;
     }
     $args['user_login'] = isset($args['user_login']) && $args['user_login'] ? $args['user_login'] : self::generate_username($args);
     $user_id = wp_insert_user($args);
     if (is_wp_error($user_id)) {
         // There was an error when inserting the user if we get here.
         foreach ($user_id->errors as $error) {
             $validation_result['form']['fields'][0]->validation_message = '<p>' . $error[0] . '</p>';
         }
         $validation_result['form']['fields'][0]->failed_validation = true;
         $validation_result['is_valid'] = false;
         return $validation_result;
     }
     wp_new_user_notification($user_id, null, 'both');
     return $validation_result;
 }
开发者ID:moxie-lean,项目名称:wp-gravity-forms,代码行数:49,代码来源:Signup.php

示例15: handleRequest

 /**
  * Handles the proxy request.
  */
 public function handleRequest()
 {
     // - context data
     $contextData = isset($_POST['opandaContextData']) ? $_POST['opandaContextData'] : array();
     $contextData = $this->normilizeValues($contextData);
     // - identity data
     $identityData = isset($_POST['opandaIdentityData']) ? $_POST['opandaIdentityData'] : array();
     $identityData = $this->normilizeValues($identityData);
     // prepares data received from custom fields to be transferred to the mailing service
     $identityData = $this->prepareDataToSave(null, null, $identityData);
     do_action('opanda_lead_catched', $identityData, $contextData);
     if (is_user_logged_in()) {
         return false;
     }
     $email = $identityData['email'];
     if (empty($email)) {
         return;
     }
     if (!email_exists($email)) {
         $username = $this->generateUsername($email);
         $random_password = wp_generate_password($length = 12, false);
         $userId = wp_create_user($username, $random_password, $email);
         wp_new_user_notification($userId, $random_password);
         do_action('opanda_registered', $identityData, $contextData);
     } else {
         $user = get_user_by('email', $email);
         $userId = $user->ID;
     }
     /* 
      * Unsafe code, should be re-written
      */
     /*
             if ( !is_user_logged_in() ) {
     
                 $mode = $this->options['mode'];
     
                 if ( in_array( $mode, array('hidden', 'obvious')) ) {
                     wp_set_auth_cookie( $userId, true );
                 }  
             }*/
 }
开发者ID:visitcasabacardi,项目名称:backup-nov-08-2015,代码行数:44,代码来源:signup.php


注:本文中的wp_new_user_notification函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。