Pi_portrait2_small Mike Aparicio 1 post

Hi Ryan, I am really enjoying your screencasts. In regards to screencast #8, is there a way to re-direct people to the page they were initially trying to access once they login instead of bouncing them back to the homepage? Thanks!

Mike

 
Ryanirelan_headshot_48x48_small Ryan Irelan 73 posts

Thanks, Mike!

Is there a way to re-direct people to the page they were initially trying to access once they login instead of bouncing them back to the homepage?

You can do:

{exp:member:login_form return="-2"}

but there have been reports of that being buggy when using embedded templates.

Another way that’s not pretty, but it can be done:

{exp:member:login_form return="{segment_1}/{segment_2}"}

Notice, however, that this is hardcoded in a way, so if you’re on a page that has more than two segments it won’t work properly. So, it’s not an ideal solution. You could use some conditionals to check to see if the segments are empty or not, but it just shouldn’t have to be that hard. :)

2 posts, 2 voices