Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My question is how to force the users that are auto-logged in because they previously checked "remember me" to log in again?

It may be something with cookies, but is there anything I can change/modify to do this ?

Thank you.

UPDATE

Generally, using jQuery cookie plugin, the code that checks for a cookie in user's system looks like this.

$(document).ready(function(){
if(!$.cookie('name-of-cookie')){
    $.cookie('name-of-cookie', 'true', { expires: 2});
.
.
}

Is there any similar in Wordpress to handle this?

share|improve this question
    
You can still do this, using jQuery, since jQuery is bundled with WordPress. the $.cookie() method is not available out of the box with jQuery however, so you'll need to use the $.cookie plugin if you don't want to roll your own handler: plugins.jquery.com/files/issues/jjquery.cookie-modified.js_.txt How-To: jquery-howto.blogspot.com/2010/09/… –  Tom Auger Oct 28 '11 at 20:10

2 Answers 2

up vote 1 down vote accepted

You can reset the security keys, forcing all cookies to expire and all users to log back in. Edit wp-config.php and change even one character in any of the security strings.

There's a plugin that allows you to set the expiry time on your user's cookies. I haven't personally used it, so proceed with caution: Cookie Timout

Sending the user back to /wp-login.php?reauth=true removes the cookie and logs the user out, even if he was previously logged in with a cookie.

Finally, if you're developing a plugin or theme, you can call wp_clear_auth_cookie(); and the currently-logged-in user's cookie will be cleared. This will not necessarily log the user out, but it will remove the cookie for the next time the user visits the site.

share|improve this answer
    
Thank you. Which one of those keys? Anyone ? define('AUTH_KEY', ''); define('SECURE_AUTH_KEY', ''); define('LOGGED_IN_KEY', ''); define('NONCE_KEY', ''); –  Xalloumokkelos Oct 28 '11 at 20:22
    
Did it. Thanks! –  Xalloumokkelos Oct 28 '11 at 20:27
    
Any one, but the one that makes most sense in this case would be LOGGED_IN_KEY –  Tom Auger Oct 30 '11 at 2:58

If you don't mind using a plugin this one will fix you up: http://wordpress.org/extend/plugins/inactivity-auto-sign-out-plugin/

share|improve this answer
    
Thank you for this. I am looking something more like my updated question. However I will try it if nothing found but I think is not what I want. –  Xalloumokkelos Oct 28 '11 at 20:04
    
Your updated question is how the suggested pugin handles the issue. There's always at least two ways to do something the wrong way and the right way. All plugin=-s mentioned so far limit the cookie expiration time which will do what you are needing. My suggestion doesn't offer a fancy interface and to make changes to the amount of time logged in you need to actually crack open the code. I just thought I'd give the plugin author some credit instead of copy/pasting his code. Whichever route you choose I'm sure it will work, good luck. –  Jeremy Jared Oct 28 '11 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.