示例#1
0
 private function callback_register()
 {
     $form_args = wpsc_get_register_form_args();
     $validation = wpsc_validate_form($form_args);
     if (is_wp_error($validation)) {
         wpsc_set_validation_errors($validation);
         return;
     }
     return wpsc_register_customer($_POST['username'], $_POST['password'], true);
 }
示例#2
0
 private function callback_register()
 {
     $form_args = wpsc_get_register_form_args();
     $validation = wpsc_validate_form($form_args);
     if (is_wp_error($validation)) {
         wpsc_set_validation_errors($validation);
         return;
     }
     extract($_POST, EXTR_SKIP);
     $errors = new WP_Error();
     do_action('register_post', $username, $email, $errors);
     $errors = apply_filters('registration_errors', $errors, $username, $email);
     if ($errors->get_error_code()) {
         wpsc_set_validation_error($errors);
         return;
     }
     $password = wp_generate_password(12, false);
     $user_id = wp_create_user($username, $password, $email);
     if (is_wp_error($user_id)) {
         foreach ($user_id->get_error_messages() as $message) {
             $this->message_collection->add($message, 'error');
         }
         return;
     }
     if (!$user_id) {
         $message = apply_filters('wpsc_register_unknown_error_message', __('Sorry, but we could not process your registration information. Please <a href="mailto:%s">contact us</a>, or try again later.', 'wpsc'));
         $this->message_collection->add(sprintf($message, get_option('admin_email'), 'error'));
         return;
     }
     update_user_option($user_id, 'default_password_nag', true, true);
     //Set up the Password change nag.
     $this->send_registration_notification($user_id, $username, $email, $password);
     $this->message_collection->add(__('We just sent you an e-mail containing your generated password. Just follow the directions in that e-mail to complete your registration.', 'wpsc'), 'success', 'main', 'flash');
     wp_redirect(wpsc_get_login_url());
     exit;
 }
示例#3
0
function wpsc_get_register_form()
{
    $args = wpsc_get_register_form_args();
    return apply_filters('wpsc_get_register_form', wpsc_get_form_output($args));
}