2 Day No Memember Cookies
-
I noticed that when I don’t check “Remember Me” on login that the logged in cookie expires when I close the browser. I took a closer look at wp_set_auth_cookie() and noticed that if the box isn’t checked the expire time is set to 0 seconds which expires the cookie when the browser closes.
I definitely could be missing something hear, but aren’t those cookies supposed to last for two days?
Here is the code I am talking about from pluggable.php. Starting on line 664:
if ( $remember ) {
$expiration = $expire = time() + apply_filters('auth_cookie_expiration', 1209600, $user_id, $remember);
} else {
$expiration = time() + apply_filters('auth_cookie_expiration', 172800, $user_id, $remember);
$expire = 0;
}
and then when the cookies are set starting on line 692:
if ( version_compare(phpversion(), '5.2.0', 'ge') ) {
setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
if ( COOKIEPATH != SITECOOKIEPATH )
setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
} else {
$cookie_domain = COOKIE_DOMAIN;
if ( !empty($cookie_domain) )
$cookie_domain .= '; HttpOnly';
setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, $cookie_domain, $secure);
setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, $cookie_domain, $secure);
setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, $cookie_domain, $secure_logged_in_cookie);
if ( COOKIEPATH != SITECOOKIEPATH )
setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, $cookie_domain, $secure_logged_in_cookie);
}
Wouldn’t we want to change line 668 to read something like:
$expire = time() + 172800;
instead of:
$expire = 0;
Thanks.
- The topic ‘2 Day No Memember Cookies’ is closed to new replies.