Definition:
function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {}
Generate authentication cookie contents.
Parameters
- int $user_id: User ID
- int $expiration: Cookie expiration in seconds
- string $scheme: Optional. The cookie scheme to use: auth, secure_auth, or logged_in
Return values
returns:Authentication cookie contents
Defined filters
- auth_cookie
apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme)
Source code
function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') { $user = get_userdata($user_id); $pass_frag = substr($user->user_pass, 8, 4); $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme); $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key); $cookie = $user->user_login . '|' . $expiration . '|' . $hash; return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme); }
3669
No comments yet... Be the first to leave a reply!