Topic-icon ask login to user

Active Subscriptions:

None
12 years 9 months ago #35816 by andbal2
ask login to user was created by andbal2
hi, i need ask facebook login to guest, so when guest show a page i need redirect to page login, ask to connect with facebook and after redirect to previous page. i used flexi custom code to redirect guest to login page but when they connected, i don't know how to redirect to previous page. the script history.back(); doesn't work with safari, maybe i need to redirect to previous page using php. any idea? tx, best regards
The topic has been locked.
Support Specialist
12 years 9 months ago #35828 by alzander
Replied by alzander on topic ask login to user
Andrea,
Set the New User and Returning User Redirections to "same page". Then, when you redirect the user to your login page with Flexi Custom Code, add a query parameter to the URL of 'return' with a base64 encoding of the current URL. Generally, that would looks something like:
$loginUrl = 'index.php?option=com_users&view=login&return='.base64encode(JUri::current());
That URL will obviously need to be tweaked for your site, but the JFBConnect should detect and use that return URL on any page it's present on.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 9 months ago #36357 by andbal2
Replied by andbal2 on topic ask login to user
hi maybe i didn't explain problem in right way, i try to be more clear

i need to force login for all visit to my web site, for this reason when a visitor shows a page i redirect him to login page and only if he logins or registers to my web site i redirect him another time to the original page he visited. the problem is in the last step, i'm not able to redirect to original page because url is not saved in history before first redirect

for first redirect i use for not users
<script type="text/javascript">
window.location.href = '/login-guest';
</script>

for second redirect, after login or registration i use
<script type="text/javascript">
history.back(-1);
</script>

i think i need to add a script to add url to history before first redirect

tx, best regards
The topic has been locked.
Support Specialist
12 years 9 months ago #36386 by alzander
Replied by alzander on topic ask login to user
The history.back(-1) likely won't work with JFBConnect since there are multiple redirects that we perform with the social network to actually authenticate the user.

What you'll want to do is update the window.location.href line to add the return parameter to that URL. The below may work, but you'll need to test:
window.location.href = '/login-guest?return='.jfbc.return_url

Hope that helps,
Alex
The topic has been locked.