Welcome, visitor! Log in
 

Source View: pre_user_login

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN  (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
13  
14  /** WordPress Registration API */
15  require_once( ABSPATH . WPINC . '/registration.php');
16  
17  if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
18       check_admin_referer('add-user');
19  
20       if ( ! current_user_can('create_users') )
21            wp_die(__('You can’t create users.'));
22  
23       $user_id = add_user();
24  
25       if ( is_wp_error( $user_id ) ) {
26            $add_user_errors = $user_id;
27       } else {
28            $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
29            $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add';
30            wp_redirect( $redirect . '#user-' . $user_id );
31            die();
32       }
33  }
34  
35  $title = __('Add New User');
36  $parent_file = 'users.php';
37  
38  wp_enqueue_script('wp-ajax-response');
39  wp_enqueue_script('user-profile');
40  wp_enqueue_script('password-strength-meter');
41  
42  require_once ('admin-header.php');
43