3

Before I update a Wordpress install (including the theme and various plugins) I wanted to ensure no one is logged in and editing the site.

Is there a way to do this?

Thanks!

4 Answers 4

2

Because of the stateless nature of webpages, you can't do this without a high margin of error.

You can install a plugin to log last visits for logged in users, but that will not tell you if they're editing posts or if they loaded a page then went to lunch or shut down their computer.

Instead, use maintenance mode and arrange beforehand when to update the site. Anybody who wants to make edits or modifications at those times knows theres a chance it will be lost and they do so at their own risk.

2
3

WordPress doesn't provide a built-in way to see a currently logged in user, but this plugin may help: WP Last Login.

Using this plugin you'll log the datetime of your users' login. The plugin appears to provide a column with the last login date... But you'll be wanting to see the actual time I imagine. If there's no way to format that, you can just inspect the database (before you update) and see if anyone's "last login datetime" is within the last few minutes or so.

1
  • Thanks Jared for your prompt reply. I believe Tom's answer was just a bit more helpful. Commented Oct 5, 2012 at 17:30
0

you could also intall a session timeout plugin.

Then you can 100% know if all users are logged out or not...

any user that has not logged out either manually or with the session timeout will be too much of a risk, so just don't update then.

When all users are logged out you will know...

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 28, 2022 at 14:54
-1

Maybe the conditional functions help you

if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.