Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jmlmj on "auto logout in custom child theme"

$
0
0

Hi there,

I'm looking to create a situation whereby a user who is logged in via a specific IP is automatically logged out after N number of minutes of inactivity.

Is this possible?

I know that there are some plugins to do this, but I was hoping on doing it with my child theme. I have the following in the functions.php file:

$login_time_ms = (1000 * 60) * 120; //2 hrs
function academicachild_timeout($expiration, $user_id, $remember){
    return $remember ? $expiration : $login_time_ms;
}
add_filter('auth_cookie_expiration', 'academicachild_timeout', 99, 3);

...But it seems that as soon as I enable that, no one can log in (including admin).
Any clues?

Thanks!


Viewing all articles
Browse latest Browse all 8245

Trending Articles