[wp-hackers] Reset Login Timer

Chris Williams chris at clwill.com
Wed Mar 14 19:37:29 UTC 2012


I tried asking this in the wp.org forums, got no hits.  Was wondering if someone here could advise.

I'm writing a plugin that relies on the user being logged in to access a number of features. The login expires after a period of time (24 hrs, I believe?). I want to have it reset if/when there is any activity - can be just a page load doesn't have to be anything fancy (like typing on the page).  Was thinking of adding some code into my page header to reset the cookies.  Just looking through things and I see that it looks like wp_set_auth_cookie() is the thing I want. I see that in user.php, there is a case where it does:

wp_clear_auth_cookie();
wp_set_auth_cookie($ID);

Does this seem like a good approach? Anyone know any problems/issues here, am I missing something?

Thanks in advance,
Chris


More information about the wp-hackers mailing list