[Code] Redirect Logged-in Members

Article author
Duncan Hamra

This article will show you how to redirect users away from pages they don't need anymore. Usually this is a signup or login page.

Add the following script to the Header or Footer of any page where you want to redirect logged-in members. The script will redirect more quickly if you place it in the header. 

You'll want to replace "/" with something else. Usually a dashboard page or profile page like "/dashboard".

<script>
const memberstack = window.$memberstackDom
memberstack.getCurrentMember().then((member) => {
      if (member.data) {
           window.location.replace("/");
      }
    })
</script>

Was this article helpful?

Comments

1 comment

Please sign in to leave a comment.