July 1, 2024
In this article, we’ll be discussing how you can force logout any users in WordPress and show them a popup that they have been logged out. We’ll be using the Inactive Logout plugin for this.
Force logout can be helpful in removing unwanted sessions if any passwords were compromised. You can force logout any users as an admin before a user can make unwanted changes. Basically, If a user’s account is compromised, logging them out can prevent further damage.
Secondly, Managing active sessions can help reduce server load and prevent unauthorized access upto some degree. So, you can hook up a cronjob to logout any users who have closed their browser.
You’ll need the free version of the Inactive Logout plugin initially to track user idle sessions. To enable the forced logout feature and customize the popup message, you’ll also require the pro version of the Inactive Logout plugin.
After you’ve installed the pro version of the Inactive Logout plugin, navigate to the wp-admin dashboard and go to the Users section. Here, you will see a logout button for each user, as shown in the screenshot below. This allows you to easily force logout individual users directly from the admin panel.
Click on the logout button to force logout this user from all sessions.
With inactive logout pro version you can show a popup to the user when admin force logs that specific user. User will see a popup on their side that they have been logged out.
When an admin force logs out a user, the user will be logged out and will receive a popup notification similar to the one shown in the image below. This popup informs the user that they have been logged out, provides a reason, and instructs them to contact the administrator if they believe this action was taken in error. The message also includes a countdown before the user is redirected.
You can also customize this message from inactive logout settings page.
Another handy feature about this is that if there is something wrong on your site perhaps an error maybe then the popup would automatically trigger as well.
This is how you can force logout any users in your WordPress site. Inactive Logout has many other features not limited this though. You can check this out on the pricing page table.
Get concurrent logins, browser close logout, and more by upgrading.