开发者 |
joelcj91
duckdev |
---|---|
更新时间 | 2022年7月19日 17:50 |
捐献地址: | 去捐款 |
PHP版本: | 5.6 及以上 |
WordPress版本: | 6.0 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Loggedin 🔒 Features and AdvantagesPlease contribute to the plugin development in GitHub. 🔐 Important Notice Even if the user is closing the browser without logging out, their login session exists for period of time. So this will also considered as an active login.Installation | Support | Screenshots
- Set maximum no. of active logins for a user.
- Block new logins when the login limit is reached.
- Allow new logins while logging out from other devices when the limit is reached.
- Force logout users from admin.
- Prevent users from sharing their account.
- Useful for membership sites (for others too).
- No complex settings. Just one optional field to set the limit.
- Super Light weight.
- Filter to bypass login limit for certain users or roles.
- Completely free to use with lifetime updates.
- Follows best WordPress coding standards.
loggedin.zip
to your plugins directory, which usually is /wp-content/plugins/
.This plugin does not have a seperate settings page. But we have one configural settings to let you set the login limit.
Settings
page in admin dashboard.🔐 Loggedin
.Maximum Active Logins
option.You can forcefully logout the user from other devices and allow new login.
Settings
page in admin dashboard.🔐 Loggedin
.Login Logic
as Allow
.You block the new logins when the user is logged in from maximum no. of devices according to the limit you set.
Settings
page in admin dashboard.🔐 Loggedin
.Login Logic
as Block
.That depends. If the “Remember Me” box is checked while login, WordPress will keep the user logged in for 14 days by default. If “Remember Me” is not checked, 2 days will be the active login session time. You can change that period using, auth_cookie_expiration filter. function loggedin_auth_cookie_expiration( $expire ) { // Allow for a month. return MONTH_IN_SECONDS; } add_filter( 'auth_cookie_expiration', 'loggedin_auth_cookie_expiration' );
You can forcefully logout a user from all the devices he has logged into. Get his WordPress user ID and,
Settings
page in admin dashboard.🔐 Loggedin
.Force Logout
.Yes, of course. But this time you are going to add few lines of code. Don't worry. Just copy+paste this code in your theme's functions.php
file or in custom plugin:
function loggedin_bypass_users( $bypass, $user_id ) {
// Enter the user IDs to bypass.
$allowed_users = array( 1, 2, 3, 4, 5 );
return in_array( $user_id, $allowed_users );
}
add_filter( 'loggedin_bypass', 'loggedin_bypass_users', 10, 2 );
Or if you want to bypass this for certain roles:
function loggedin_bypass_roles( $prevent, $user_id ) {
// Array of roles to bypass.
$allowed_roles = array( 'administrator', 'editor' );
$user = get_user_by( 'id', $user_id );
$roles = ! empty( $user->roles ) ? $user->roles : array();
$bypassed = array_intersect( $roles, $allowed_roles );
return ! empty( $bypassed );
}
add_filter( 'loggedin_bypass', 'loggedin_bypass_roles', 10, 2 );