We run a staging and live environment and I would like to prevent my editors to login into the live website.
However, every time we push the staging -> live, the users are synchronized, so creating different users on different environments is not a possibility since we are pushing the staging daily.
Today one of the editors logged in to the live website by mistake and messed up the HTML and broke the homepage.

I think the way to go is to just “disable” certain users in the LIVE environment which can be detected by the domain, URL or path.
The way I see it is basically a plugin that will add a check-box (“allow to login to LIVE”) to the users page.
The plugin will just need a setting page where you enter the LIVE URL (any other domain would be considered staging).
From there I just have to code the logic to prevent logging in by comparing domain (staging or live) and the flag on the user.

My question is does anybody had this problem before and how did you solve it? Also if somebody has already coded what I’m talking about, the code would be really appreciated.

Thanks!

Read more here: How to disable (prevent from logging in) users depending on environment (staging or live)?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , ,

Wordpress related questions and answers: