Logged in user can't open restricted page - possible caching issue

Hi,

New to S2member, and the forum. Have searched but can’t find anything exactly like this issue. This is a site that has been set up for a long time which I am now supporting.

These are the steps that re-create the problem:

  1. User (not logged in) arrives on the site home page
  2. User (not logged in) clicks to access a restricted page
  3. User (not logged in) re-directed to sign-up / login page
  4. User logs in
  5. User clicks to access the same restricted page as above
  6. User is re-directed to sign-up / login page

It looks like the page URL with all the s2member parameters in step 2 is being cached by the browser and then replayed in step 5 regardless of the fact that the user has now logged in. The URL has the following parameters:

?_s2member_vars=page…level…0…page…1040…L2pvYnMv&_s2member_sig=1515659278-9ad0cb9f2b0d98efe12b26dd4d9c8e4b

If you clear the browser cache after step 4 everything works fine. And if the user doesn’t try accessing the restricted page before logging in, everything works as expected.

Probably not an s2member issue specifically, but as it is controlling the re-directs I wondered if there is anything I can do to prevent the above from happening.

This is s2member pro and bang up-to-date.

Many thanks,

Andrew

The problem is with the caching. s2Member isn’t compatible with certain sorts of caching, particularly object caching. My guess is that either you have a plugin (like W3 Total Cache) that has been wrongly set to do object caching, or else you have server level caching operating that is causing this (in which case Varnish/Cachewall is the most likely culprit, and you will need to ask your host to turn it off).

Thanks Tim - I thought that might be the case.

We’re not using any cache plugins, but we’re on WPEngine so their cache is on. Limited options on that, however, they do allow you to switch off object caching and it is definitely off.

I’ll ping them and see if they can disable caching completely on the particular page in question.

Thanks for your quick response!

Andrew

UPDATE: WPEngine have disabled caching for the page in question and the issue is resolved.

Thanks again,

Andrew

1 Like

Hi, I have a similar problem in a page that is on the Restriction list for Level 4 only but it won’t let Level 4 members see it, instead it redirects to the membership options page. I contacted the web host and don’t have any caching. Already deleted my browser cache.
Any other suggestions?
Thanks in advance
Jackie

What did work for me is putting the data table I want to protect within a conditional that uses current_user_can(“access_s2member_level4”)
Then I took off the Page Restriction
It appears to work fine.

1 Like