Does anyone know of a way to force a logged in user to re-login after say 4 hours? or at a particular time to day?
For example, if they logged in at 9am, can we force them to re-login at 1pm?
|
Does anyone know of a way to force a logged in user to re-login after say 4 hours? or at a particular time to day? For example, if they logged in at 9am, can we force them to re-login at 1pm? |
|||
|
|
|
You can write javascript which will start on Update: it's a good idea to force logout only after N minutes the user is idle. You can get the idea and link to source code in jQuery idleTimer plugin article by Paul Irish. Unfortunately, demo does not work. |
||||
|
|
You can programatically logout a user in Wordpress by calling the wp_logout() function. To apply this to your 4 hour rule, consider the following code:
Putting this code in your functions.php file will log ALL users out after 4 hours. You could also move the call to check_time_limit() anywhere within your theme if you only want this rule to apply to specific pages etc. |
|||||||
|
|
The easiest way is to change the authentication cookie expiry time.
People can extend the cookie expiry in the browser, but I don't believe anyone will bother |
|||||
|
|