• 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 want to have it reset if/when there is any activity – can be just a page load doesn’t have to be anything fancy.

    I know the user is an authorized user at this point, and I have their userid, so I don’t want/need to do anything as complex as a login. Was thinking of adding some code into my page header to reset the cookies and tried wp_user_settings() with WP_ADMIN set to true, but that doesn’t seem to set the cookies, just check them.

    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?

    Thanks in advance,
    Chris

  • The topic ‘Reset Login Timer’ is closed to new replies.