Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: check_password

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
2440                 * Filters whether the plaintext password matches the encrypted password.
2441                 *
2442                 * @since 2.5.0
2443                 *
2444                 * @param bool       $check    Whether the passwords match.
2445                 * @param string     $password The plaintext password.
2446                 * @param string     $hash     The hashed password.
2447                 * @param string|int $user_id  User ID. Can be empty.
2448                 */
2449                return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2450           }
2451
2452           // If the stored hash is longer than an MD5,
2453           // presume the new style phpass portable hash.
2454           if ( empty( $wp_hasher ) ) {
2455                require_once ABSPATH . WPINC . '/class-phpass.php';
2456                // By default, use the portable hash from phpass.
2457                $wp_hasher = new PasswordHash( 8, true );
2458           }
2459
2460           $check = $wp_hasher->CheckPassword( $password, $hash );
2461
2462           /** This filter is documented in wp-includes/pluggable.php */
2463           return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2464      }
2465 endif;
2466
2467 if ( ! function_exists( 'wp_generate_password' ) ) :
2468      /**
2469       * Generates a random password drawn from the defined set of characters.
2470       *
2471       * Uses wp_rand() is used to create passwords with far less predictability
2472       * than similar native PHP functions like `rand()` or `mt_rand()`.