0

Since migrating our WordPress site to a new webserver, we have had issues where users are apparently getting logged out...but yet aren't. What I mean is, on our old server, users would sometimes get timed out and if they would submit a form, it would give one of the server error codes (500 I think), and they would realize they were timed out and had to log back in. Kind of annoying, but it didn't seem to happen too often so we dealt with it.

Now, however, instead of popping up any errors about being timed out, the website just continues as if everything is fine! Which doesn't sound bad, but we have forms/data that get submitted to us with the username included... So now if the user continues using the site not knowing they have timed out, they can actually submit a request that comes to us with the username blank, and we don't know who submitted it.

Has anyone heard of anything like this? Is this a WordPress issue, or our new server? Since switching, we actually don't get any 500 Internal Server errors anymore - if there is an issue with the code, it just won't load. Could that be part of the problem - what normally would have triggered a 500 error due to getting timed out is no longer doing so?

  • You should never get 500 errors. Not getting 500 errors is a very good thing. Preferably you'd be sending 403 Forbidden, but I don't think WordPress will send those from the front-end normally, without some sort of restriction plugin. What you should be doing is modifying your forms to require to user to be logged in to use, but let the rest of the site function normally. How to do that would depend on how the forms were created. – Jacob Peattie Aug 14 '17 at 14:53
  • Maybe it was a 403 that it used to pop up... I did just add in a check on the username to the 2 sections of our site that require being logged in, and if the username is blank I pop up a message that they have timed out and need to log in again. – Mike Aug 14 '17 at 15:07
  • Interesting...on the old webserver, the 2 pages I'm referring to wouldn't even load if you weren't logged in, they gave the 403 Forbidden error. Now if I try to go to one of those pages manually in the address bar, they actually work... – Mike Aug 14 '17 at 15:09
0

It could be a number of things. Do you check if the user is logged in on the relevant pages? For example:

is_user_logged_in() ||  auth_redirect();
  • 1
    Thanks, that did the trick! I used this in combination with looking up the user role to determine who can access our pages. I figured out what changed - on the old webserver we had a plugin we used to set permission rules and determine which user groups could view which web pages, and apparently that plugin is no longer compatible with the latest WordPress (or maybe PHP) version we are on now... – Mike Aug 14 '17 at 19:26
  • @JackJohansson your corrections are usually good but this one was done a little too fast ;) – Christian Lescuyer Aug 15 '17 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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