Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

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.

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

Source View

This hook occurs 2 times in this file.

Line Code
86           wp_die(__('Cheatin’ uh?'));
87
88      if ( !is_multisite() ) {
89           $user_id = add_user();
90
91           if ( is_wp_error( $user_id ) ) {
92                $add_user_errors = $user_id;
93           } else {
94                if ( current_user_can('edit_users') ) {
95                     $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
96                     $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add' . '#user-' . $user_id;
97                } else {
98                     $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
99                }
100                wp_redirect( $redirect );
101                die();
102           }
103      } else {
104           // Adding a new user to this blog
105           $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] );
106           unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] );
107           if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
108                $add_user_errors = $user_details[ 'errors' ];
109           } else {
110                $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
111                if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
112                     add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
113                }
114                wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
115                if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
116                     $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' ] ) );
117                     wpmu_activate_signup( $key );
118                     $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
119                } else {