Redirect depending if user is logged in or not

Redirect users to different pages based on login status in ChronoForms.

Overview

The issue occurred because the event switcher was incorrectly configured to check the user ID instead of the guest status.
Use the CF shortcode {user:guest} as the data source in the event switcher, setting the value to 0 for logged-in users and 1 for guests, then assign the corresponding redirect URLs for each condition.

Answered
ChronoForms v6
pa pat01 18 Mar, 2019
Hi

After submitting a form I want the user redirect to
URL A if the user is not logged in
URL B if the user is logged in.

I guess I need the event switcher for this. But how do I get if user is logged in or not and how to set this up in event switcher?

Thanks a lot.
Gr GreyHead 18 Mar, 2019
Hi pat01,

You can use a CF shortcode to get the User ID and check if it is set - then use the result with the Event Switcher.

Adding a Debugger action temporarily will let you see how the User ID is set in the form data.

Bob
pa pat01 18 Mar, 2019
Hi Bob and thanks

I dont' understand on where to get the User ID.

I use a PHP Action named kuid:
$kuid = {user:id}

This obviouslly is not working.

In the event switcher I use:
Redirect depending if user is logged in or not image 1

Not sure if this is correct?

Thanks a lot.

Patrick
he healyhatman 19 Mar, 2019
Answer
1 Likes
No, should be
0
1
And data source should be {user:guest}
If they're not logged in guest will be 1.
pa pat01 19 Mar, 2019
It now looks like this:

Redirect depending if user is logged in or not image 2

If user is not logged in, redirect is working to URL A: index.php?option=com_content&view=article&id=2&Itemid=101

If user is logged in, user gets redirected to /?chronoform=myformname&event=submit
instead of URL B: index.php?option=com_content&view=article&id=4&Itemid=101

I did test URL B and it is correctly working.

So redirect B is not working. Why?
he healyhatman 19 Mar, 2019
1 Likes
You should be using an event switcher, not a switch, and it should be the way I said. But do you need to REDIRECT or do you need to EVENT LOAD?
pa pat01 20 Mar, 2019
I use an Event switch already. But I had A:1 and B:0 instead of just 0 and 1. Now it works!

Thank you!
This topic is locked and no more replies can be posted.