I have 2 types of users and i want to redirect users according to his role type,how i can redirect him conditionally after login
Hi Neeraj-
You can accomplish this by using a liquid conditional statement with javascript (for the redirects) inside of it. For example, you could include this in the landing page:
{% if request.current_signup.tags contains 'role1' %}
<script>
window.location.href = 'http://www.yourdomain.com/user1';
</script>
{% elsif request.current_signup.tags contains 'role2'%}
<script>
window.location.href = 'http://www.yourdomain.com/user2';
</script>
{% else %}
<script>
window.location.href = 'http://www.yourdomain.com/neitheruser';
</script>
{% endif %}
It is also worth noting that you can use the same type of liquid conditional statements to configure a single page to look differently depending on what tags a user has. So rather than using redirects, you could just make your homepage display completely different content depending on which role the logged-in user has been tagged with.
Showing 3 reactions
Sign in with
NationBuilder employee
NationBuilder employee
NationBuilder employee