wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_authenticate_cookie › WordPress Function
Since2.8.0
Deprecatedn/a
› wp_authenticate_cookie ( $user, $username, $password )
| Parameters: (3) |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Authenticates the user using the WordPress auth cookie.
Related Functions: wp_authenticate, wp_authenticate_spam_check, wp_set_auth_cookie, wp_parse_auth_cookie, wp_clear_auth_cookie
Source
function wp_authenticate_cookie(
$user,
$username,
#[\SensitiveParameter]
$password
) {
global $auth_secure_cookie;
if ( $user instanceof WP_User ) {
return $user;
}
if ( empty( $username ) && empty( $password ) ) {
$user_id = wp_validate_auth_cookie();
if ( $user_id ) {
return new WP_User( $user_id );
}
if ( $auth_secure_cookie ) {
$auth_cookie = SECURE_AUTH_COOKIE;
} else {
$auth_cookie = AUTH_COOKIE;
}
if ( ! empty( $_COOKIE[ $auth_cookie ] ) ) {
return new WP_Error( 'expired_session', __( 'Please log in again.' ) );
}
// If the cookie is not set, be silent.
}
return $user;
}