J!Extensions Store™
Forum
Welcome, Guest
Please Login to access forum.
Refer user to the page where he came from (1 viewing) 
Go to bottom
TOPIC: Refer user to the page where he came from
#3902
Samira
Fresh Boarder
Posts: 4
User Offline
Refer user to the page where he came from Karma: 0  
Hi there,

I added the link of facebook login also to the core joomla login (elements/login.thtml) forms that are used for restricted pages with the code below. For the restricted pages, it works fine. But I can't manage to refer the user back to the same page as where he clicked on the page for pages where guests need to login (i.e. writing a comment). For those pages, also the same code does not work for the FB login. The below code for guest login works, but the user is sent back to the previous page before the current page instead of the current page.
Can you please advice?


For restricted pages:
<a href="'.$return_url.'" onclick="fblogin();return false;" class="ifbl_fbloginbutton"><img border="0" src="/modules/mod_instantfblogin/assets/images/fbk_tpl_comic.png" /></a>'

For pages where guests need to login:
<a href="'.$return_url_encoded.'" onclick="fblogin();return false;" class="ifbl_fbloginbutton"><img border="0" src="/modules/mod_instantfblogin/assets/images/fbk_tpl_comic.png" /></a>

Cheers,
Samira
 
Logged Logged  
  The administrator has disabled public write access.
#3903
John Dagelmore
Admin
Posts: 3716
User Online Now
Re:Refer user to the page where he came from Karma: 79  
Hi Samira,

i'm not sure to fully understand what you wronte and what you are trying to do.
However the return URL page is not determined by the href attribute, so this makes no sense:

href="'.$return_url.'"

The return URL is managed by the component settings and module PHP code as for the default Joomla login module. Choosing 'default' in the backend settings of the component as 'Login URL' will cause to redirect back users to the same page used for the login.

Cheers,
John
 
Logged Logged  
  The administrator has disabled public write access.
#3904
Samira
Fresh Boarder
Posts: 4
User Offline
Re:Refer user to the page where he came from Karma: 0  
Hi,

Thnx for the quick reply. I see indeed the href was nonsense I removed it and it still gives the same result. The configuration in backend is set to default for user login indeed.

For the page where guests can login to leave comment, they are sent back to the parent page of the current page instead of the current page.

You can see the example here - The FB login is at the end of the page.
http://145.131.3.187/index.php/juwelier/le-mariage-trouwringen#reviewForm
 
Logged Logged  
  The administrator has disabled public write access.
#3905
John Dagelmore
Admin
Posts: 3716
User Online Now
Re:Refer user to the page where he came from Karma: 79  
Yes that's expected.

The login redirection works with menu Itemid of Joomla so you will always get the redirection to the routed menu ID. If the page is not directly linked to any menu the redirection will fallback to the nearest parent page linked to the menu.

If you want a different behavior you need a custom code in the function getReturnURL contained in the module file joomlapath/modules/mod_instantfblogin/helper.php to use always a current URL instead of perform a Joomla menu routing.
 
Logged Logged  
  The administrator has disabled public write access.
#3906
Samira
Fresh Boarder
Posts: 4
User Offline
Re:Refer user to the page where he came from Karma: 0  
Ok, got it. I added the below, so now it refers the user to the current page.
$url = cmsFramework::getCurrentUrl();

Though, the FB login still gets stuck if the page has not been refreshed at least once by the user. So basically for a normal user, the FB keeps showing the wheel "Please wait, logging in" endlessly. Any idea why that would be?

Example url:
http://145.131.3.187/index.php/juwelier/le-mariage-trouwringen#reviewForm
 
Logged Logged  
  The administrator has disabled public write access.
#3907
John Dagelmore
Admin
Posts: 3716
User Online Now
Re:Refer user to the page where he came from Karma: 79  
Good.

Yes the problem is the anchor, it's not accepted in the Facebook Login URL, the links must be without the anchor fragment:

http://145.131.3.187/index.php/juwelier/le-mariage-trouwringen
 
Logged Logged  
  The administrator has disabled public write access.
Go to top