• Resolved onefastbusiness

    (@onefastbusiness)


    I’m building a membership site… there is some free content and some premium content.
    I have 4 type of pages on my site:
    1) free content pages
    2) login/register page
    3) purchase membership page
    4) premium content pages

    Now everything works well if I (as a premium user):
    – come to the site
    – first login before doing anything else
    – click on a premium content link
    – I end up on premium content page(s)

    However if I do this (again as a premium user):
    – come to the site
    – click on premium content link
    – redirects me to login page (ok)
    – I login and I’m redirected to purchase membership page (ok)
    – but since I’m already a premium member it redirects me back to homepage (ok)
    BUT HERE COMES THE PROBLEM
    – I click on premium content link and I’m again redirected to homepage

    I suspect what happens here is that (even though I’m logged in)
    – I’m redirected to login page
    – then login page figures out I’m logged in so it redirects me to membership purchase page
    – membership purchase page figures out I’m already a member so it redirects me to homepage (as it should)

    The problem is I shouldn’t be redirected to login page since I’m already logged in.
    But it seems to me that since the first time I tried to access the premium content link (when I was logged out) the plugin remembered it an redirected me to login page regardless.
    And now I don’t know how to make it forget the initial action once my user is logged in.

    Please help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support mark l chaves

    (@mlchaves)

    Hey @onefastbusiness ,

    ?Thanks for reaching out and for your explanation. We’re sorry you’re seeing that redirect issue.

    A couple of questions:

    1) Can you share screen captures of your Content Control restrictions?

    2) From your explanation, it sounds like you’re using a custom login form. If so, can you temporarily disable it so you can run a test only using WordPress’s default login feature?

    3) Lastly, can you also try again with all of your caching turned off?

    Feel free to follow up via our contact form for a more private channel.

    https://code-atlantic.com/contact-us/

    We look forward to your reply ??

    Thread Starter onefastbusiness

    (@onefastbusiness)

    Hey… I don’t have any caching on my website since it’s very lightweight and has zero images and I want to be able to update my content real-time so that my users always get the latest version of the content.

    Yes I am using custom login form (Forminator) because I don’t like the flow of wordpress and it might get users confused and also it’s a break from my website design.

    Anyways, I found a temporary solution so anyone can use it that has this problem.

    It seems that only the EXACT url path is cached so if you can modify it without affecting its destination that solves the problem.

    For example: https://www.mypath.com?123

    So I decided to modify all my existing membership links with a short JavaScript code that I added at the end of every page (with Insert Headers And Footers plugin)

    Basically what it does is it finds all my membership links (which is easy to do because they all have “-member-” in their URL and just appends the timestamp at the end. Baiscally it turns this:
    https://www.mysite.com/some-member-link
    into this:
    https://www.mysite.com/some-member-link?1639388878443

    And since timestamp is always different there is no way of ever caching my membership links.

    JavaScript code is below:

    
    <script>
    // fixing caching problem for Content Control plugin
    const allLinks = document.querySelectorAll('a');
    allLinks.forEach((link) => {
      if (link.href.includes('-member-')) {
        link.href = link.href + '?' + (new Date()).getTime();
      }
    });
    </script>
    
    Plugin Support mark l chaves

    (@mlchaves)

    Hey @onefastbusiness,

    Yes. That’s a clever cache-busting technique. Thanks so much for sharing.

    Cache busting using query parameters does have a side-effect that you might want to know about. Learn more here.

    https://www.keycdn.com/support/what-is-cache-busting

    Please remember that the Content Control plugin is *not* a cache plugin nor does it have a cache. Also, it’s possible to cache websites without using a cache plugin so you could check with your developer or host provider if there’s caching in place you don’t know about.

    If you find something that points back to Content Control, please let us know! ??

    Cheers ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin caches redirects even after user login’ is closed to new replies.