Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_authenticate_user

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
149      /**
150       * Filters whether the given user can be authenticated with the provided $password.
151       *
152       * @since 2.5.0
153       *
154       * @param WP_User|WP_Error $user     WP_User or WP_Error object if a previous
155       *                                   callback failed authentication.
156       * @param string           $password Password to check against the user.
157       */
158      $user = apply_filters( 'wp_authenticate_user', $user, $password );
159      if ( is_wp_error($user) )
160           return $user;
161
162      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
163           return new WP_Error( 'incorrect_password',
164                sprintf(
165                     /* translators: %s: user name */
166                     __( '<strong>ERROR</strong>: The password you entered for the username %s is incorrect.' ),
167                     '<strong>' . $username . '</strong>'
 
Line Code
219           return new WP_Error( 'invalid_email',
220                __( '<strong>ERROR</strong>: Invalid email address.' ) .
221                ' <a href="' . wp_lostpassword_url() . '">' .
222                __( 'Lost your password?' ) .
223                '</a>'
224           );
225      }
226
227      /** This filter is documented in wp-includes/user.php */
228      $user = apply_filters( 'wp_authenticate_user', $user, $password );
229
230      if ( is_wp_error( $user ) ) {
231           return $user;
232      }
233
234      if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
235           return new WP_Error( 'incorrect_password',
236                sprintf(
237                     /* translators: %s: email address */