ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Redirect depending if user is logged in or not

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.
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
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:
Screenshot_1.jpg

Not sure if this is correct?

Thanks a lot.

Patrick
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.
pat01 19 Mar, 2019
It now looks like this:

Screenshot_1.jpg

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?
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?
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.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com