Topic-icon Facebook Login Button redirection Issue

Active Subscriptions:

None
As title, is it possible to set 2 different redirection for 2 different FB login buttons?(one to same page, one to homepage)
I am using sclogin FB login buttons.

If no quick solution, how could i override the redirection for a specific button?

Thanks
The topic has been locked.
Support Specialist
10 years 7 months ago #36674 by alzander
There isn't an easy way to override it for a specific button. When the button is called, it triggers our Javascript and that Javascript is the same for all buttons. There would have to be a lot of changes to the button itself, our Javascript file (jfbconnect.js) and the actual redirection code in the /components/com_jfbconnect/models/loginregister.php file.

If you're using the "Same Page" redirection feature for all the other links, and just want one button to go to a different URL, that *may* be the easiest, but still causes some issues. Basically, with 2 buttons on the same page, they're going to want to go to the same place. If you have different buttons on different pages that go to different places, that would actually be a little easier.

Let me know which configuration you'd be going for.

Thanks,
Ale
The topic has been locked.
Active Subscriptions:

None
10 years 7 months ago #36692 by fb_634042543
Hi Alex,

I am using the "Same Page" redirection feature for all the other links, and just want one button to go to a home page(as it's the button placed in login page).

I could manage to show only one button in login page. Could you give me some hint for that? Thanks a lot.
The topic has been locked.
Support Specialist
10 years 6 months ago #37004 by alzander
Anson,
Very sorry for the delay in getting back to this. If you're still looking for way to control the redirect when logging in from a specific page, please try the following edit in the /components/com_jfbconnect/controllers/authenticate.php . Around line 98, you'll see a block of code that looks like:
else
            $return = 'index.php';

        JFactory::getApplication()->setUserState('com_jfbconnect.login.return', $return);
    }
In there, we'll add some code to detect if the redirection to the 'current' page is the page you have your special login button on and, if so, update the redirection to whatever page you want to go to:
else
            $return = 'index.php';

        if ($return == 'index.php?option=com_blah...') // or '/SEF-URL')
             $return = "link-to-page-to-return-to.html';

        JFactory::getApplication()->setUserState('com_jfbconnect.login.return', $return);
    }
I hope that helps, but please let us know how it goes or if you run into any issues.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 6 months ago #37377 by fb_634042543
I added the following code in the file and now it work perfectly. Thanks a lot. Alex :D
		if ($return == "/index.php?option=com_users&view=login" || $return == "/login")
		{
             $return = "/";
		}


alzander wrote: Anson,
Very sorry for the delay in getting back to this. If you're still looking for way to control the redirect when logging in from a specific page, please try the following edit in the /components/com_jfbconnect/controllers/authenticate.php . Around line 98, you'll see a block of code that looks like:

else
            $return = 'index.php';

        JFactory::getApplication()->setUserState('com_jfbconnect.login.return', $return);
    }
In there, we'll add some code to detect if the redirection to the 'current' page is the page you have your special login button on and, if so, update the redirection to whatever page you want to go to:
else
            $return = 'index.php';

        if ($return == 'index.php?option=com_blah...') // or '/SEF-URL')
             $return = "link-to-page-to-return-to.html';

        JFactory::getApplication()->setUserState('com_jfbconnect.login.return', $return);
    }
I hope that helps, but please let us know how it goes or if you run into any issues.

Thanks,
Alex

The topic has been locked.
Support Specialist
10 years 6 months ago #37389 by alzander
Anson,
Awesome! I'm very glad to hear that got you going. As always, should you need anything else, just let me know.

Thanks,
Alex
The topic has been locked.