Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_login_failed

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 3 times in this file.

Line Code
415      if ( '' == $username )
416           return new WP_Error('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
417
418      if ( '' == $password )
419           return new WP_Error('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
420
421      $user = get_userdatabylogin($username);
422
423      if ( !$user || ($user->user_login != $username) ) {
424           do_action( 'wp_login_failed', $username );
425           return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.'));
426      }
427
428      $user = apply_filters('wp_authenticate_user', $user, $password);
429      if ( is_wp_error($user) ) {
430           do_action( 'wp_login_failed', $username );
431           return $user;
432      }
433
434      if ( !wp_check_password($password, $user->user_pass, $user->ID) ) {
435           do_action( 'wp_login_failed', $username );
436           return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.'));
437      }
438
439      return new WP_User($user->ID);
440 }
441 endif;
442
443 /**
444  * wp_logout() - Log the current user out