How to redirect new users to a welcome page instead of their CMS template when they haven't selected a plan yet?

Post author
Michael Ola

Is there a resources for create a CMS template page when a user create account? I have searched through the internet nothing.

Comments

6 comments

  • Comment author
    Boggan null

    I learn it and works with this one:
    https://www.youtube.com/watch?v=ukmzHvYfs-8&t=727s&pp=ygUfZGFzaGJvYXJkIHBlcnNvbmFsaXphZG8gd2ViZmxvdw%3D%3D

    The most important thing is in the logic of creating the item with the automation of Zapier + Memberstack + Webflow

    Once you understand it, the whole picture becomes clearer.

    0
  • Comment author
    A J

    Michael Ola, to add-on to what Boggan said earlier, here's also a starter guide which will help you secure the member specific pages if you need to do so.

    0
  • Comment author
    Michael Ola

    I have successfully created a Unique membership dashboard using Zapier and Memberstack. The tutorial above was helpful.

    Now when a user creates account, the login redirect is their dynamic CMS template page. However, I have a gated content rule that when a user logs in after creating account and they haven't picked a plan, they'll be redirected to a Welcome page so they can choose plan.

    However the above is not working. User still gets sent to their Dynamic CMS when do don't have a plan instead of the gated content page which lets them choose a plan.

    0
  • Comment author
    Chukwudi Onyekwere

    Hi Michael,If your dynamic CMS page follows the structure cmsfolder/<cms-dynamic-page>, you’ll need to gate access to the entire cmsfolder using the "starts with" condition in the gated content section in Memberstack. This way, even if the login redirect is triggered, users without a plan will be sent to the "Access Denied" page (in this case should be the Welcome page) that you’ve set up instead of their dynamic CMS page.

    Alternatively, you can implement dynamic logic for your CMS template page. If this page is set as the default redirect after login, you may need to add conditional logic to check whether the user has selected a plan. If not, they can be redirected to the Welcome page instead. This approach might require some custom JavaScript to handle the redirect based on the user’s plan status. Here’s a basic script that should work:

    <script>
    document.addEventListener("DOMContentLoaded", async function() {
      window.$memberstackDom.getCurrentMember().then((member) => {
        if (member) {
          const plans = member.data["planConnections"] || [];
          const hasPaidPlan = plans.some(plan => plan["type"] !== "FREE");
          
          if (!hasPaidPlan) {
            window.location.href = "/welcome"; // Redirect to welcome if no paid plan
          }
        }
      });
    });
    </script>
    

    This will ensure that users who haven't selected a plan are sent to the Welcome page, while those who have a plan are redirected to their CMS page.

    0
  • Comment author
    Michael Ola

    I am using the script option but it flashes the gated page first before redirecting to the "Access Denied" page.

    Also, I would like this to take effect for "Free Plans" also. As long as the user has a plan, paid or free.

    0
  • Comment author
    A J

    Hey Michael Ola, you can use skeleton loaders to delay displaying the content for few seconds on the gated page so that before they are loaded Memberstack is able to redirect them to access denied page.

    And to check whether the logged in user has a plan and redirect accordingly, you can update the script to the following:

    <script>
    document.addEventListener("DOMContentLoaded", async function() {
      window.$memberstackDom.getCurrentMember().then((member) => {
        if (member) {
          const plans = member.data["planConnections"] || [];
          if (plans.length === 0) {
            window.location.href = "/welcome"; // Redirect to welcome if no plan is assigned
          }
        }
      });
    });
    </script>
    

    Hope this helps.

    0

Please sign in to leave a comment.