• I am looking to change the length of time that the plugin stores the cookie and session. For example, some plugins will create a cookie that gets reset (destroyed) after 2 weeks. The same plugin might reset the cookie if the user’s session is closed.

    My question is: where in the code does it say the length of time that these cookies are stored for?

    My goal is have the cookie in place for a preset amount of time regardless of whether the computer or browser has shut down.

    As another question, does anyone know of a good method that would force a browser (and possibly the computer) to remember the cookie regardless of whether or not the browser or computer was shut down?

    https://www.ads-software.com/plugins/password-protected/

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use the ‘password_protected_auth_cookie_expiration’ filter to return a length of time for the cookie to last.

    https://github.com/benhuson/password-protected/blob/master/password-protected.php#L295

    Thread Starter iqadmin

    (@iqadmin)

    Hello Ben,

    Thank you for your rapid response!

    I just have a quick follow-up question. Does the cookie depend on the existence of the user’s session? For example, if the user accidentally closes all of their browsers or if they restarted their computer, will the cookie still be active?

    Thank you very much for your help!

    Currently the cookie only lasts for the current session until a user quits their browser. I could add in another filter to set a longer expiration for the cookie itself to persist across sessions if that is helpful?

    Thread Starter iqadmin

    (@iqadmin)

    Yes, that would be great if you can do add a filter to have the cookie persist across sessions! Or you can show me how I can do that.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cookie and Session time?’ is closed to new replies.