wp_generate_user_request_key

The timeline below displays how wordpress function wp_generate_user_request_key has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Returns a confirmation key for a user action and stores the hashed version for future comparison.
 *
 * @since 4.9.6
 *
 * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
 *
 * @param int $request_id Request ID.
 * @return string Confirmation key.
 */
function wp_generate_user_request_key($request_id)
{
    global $wp_hasher;
    // Generate something random for a confirmation key.
    $key = wp_generate_password(20, false);
    // Return the key, hashed.
    if (empty($wp_hasher)) {
        require_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash(8, true);
    }
    wp_update_post(array('ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword($key)));
    return $key;
}

WordPress Version: 5.1

/**
 * Returns a confirmation key for a user action and stores the hashed version for future comparison.
 *
 * @since 4.9.6
 *
 * @param int $request_id Request ID.
 * @return string Confirmation key.
 */
function wp_generate_user_request_key($request_id)
{
    global $wp_hasher;
    // Generate something random for a confirmation key.
    $key = wp_generate_password(20, false);
    // Return the key, hashed.
    if (empty($wp_hasher)) {
        require_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash(8, true);
    }
    wp_update_post(array('ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword($key)));
    return $key;
}

WordPress Version: .10

/**
 * Returns a confirmation key for a user action and stores the hashed version for future comparison.
 *
 * @since 4.9.6
 *
 * @param int $request_id Request ID.
 * @return string Confirmation key.
 */
function wp_generate_user_request_key($request_id)
{
    global $wp_hasher;
    // Generate something random for a confirmation key.
    $key = wp_generate_password(20, false);
    // Return the key, hashed.
    if (empty($wp_hasher)) {
        require_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash(8, true);
    }
    wp_update_post(array('ID' => $request_id, 'post_status' => 'request-pending', 'post_password' => $wp_hasher->HashPassword($key), 'post_modified' => current_time('mysql', false), 'post_modified_gmt' => current_time('mysql', true)));
    return $key;
}