Redirect logged in members on site-level Answered

Post author
Brian Ficho

I am trying to keep logged in members off our guest homepage (www.nodd.net) and redirect them to our feed page. I found Memberstack article that says to put a script into that pages head tag, but it isn't work.

This is the post - https://support.memberstack.com/hc/en-us/articles/4409979719579-Redirect-Logged-in-Members

<script> MemberStack.onReady.then(function(member) { if (member.loggedIn) { window.location.replace("https://www.nodd.net/feed") } }) </script>

Does this script go on the specific webflow page I want to redirect away from? In my case the homepage?

I only want it firing on that page, but the article says to put this script below the memberstack script in the head tag, but there is not memberscript tag on the individual page, it's at the site level in webflow

Comments

3 comments

  • Comment author
    A J

    Hey Brian Ficho, yes the script does go in individual page which you don't want logged in users to visit, it is not on site-level.

    Can you try if this code works in the homepage?

    <script> const memberstack = window.$memberstackDom memberstack.getCurrentMember().then((member) => { if (member.data) { window.location.replace("/feed"); } }) </script>
    0
  • Comment author
    Julian Galluzzo

    I think AJs is right Brian Ficho - I think the code you tried to use is for memberstack v1

    0
  • Comment author
    Brian Ficho

    This worked, thanks A J Julian Galluzzo

    0

Please sign in to leave a comment.