WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )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.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 40 | check_admin_referer('add-user'); |
| 41 | |
| 42 | if ( !is_multisite() ) { |
| 43 | $user_id = add_user(); |
| 44 | |
| 45 | if ( is_wp_error( $user_id ) ) { |
| 46 | $add_user_errors = $user_id; |
| 47 | } else { |
| 48 | if ( current_user_can('edit_users') ) { |
| 49 | $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); |
| 50 | $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id; |
| 51 | } else { |
| 52 | $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); |
| 53 | } |
| 54 | wp_redirect( $redirect ); |
| 55 | die(); |
| 56 | } |
| 57 | } else { |
| 58 | $user_login = preg_replace( "/\s+/", '', sanitize_user( $_REQUEST[ 'user_login' ], true ) ); |
| Line | Code |
| 80 | wp_redirect( $redirect ); |
| 81 | die(); |
| 82 | } else { |
| 83 | // Adding a new user to this blog |
| 84 | $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] ); |
| 85 | unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] ); |
| 86 | if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { |
| 87 | $add_user_errors = $user_details[ 'errors' ]; |
| 88 | } else { |
| 89 | $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); |
| 90 | if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { |
| 91 | add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email |
| 92 | } |
| 93 | wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); |
| 94 | if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { |
| 95 | $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); |
| 96 | wpmu_activate_signup( $key ); |
| 97 | $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); |
| 98 | } else { |