× Joomla Facebook Connect support forum

Topic-icon "connect with facebok" option in login form

Active Subscriptions:

None
Hello,
in your login form there is a "connect your account with facebook" option which appears once the user has logged in...

now... I'm not using your login form, and anyway I want the form to be hidden once the user has logged in, is it possible to display that option in a separate button?
maybe you can provide me with custom code to use to create a button?

Regards
The topic has been locked.
Support Specialist
14 years 9 months ago #12719 by alzander
Niccolò,
There's a few options for doing that. First, you can use any of the methods in the common support area for a custom login button. These will, when clicked by a logged in user, map their Facebook account to the currently logged in Joomla user. For more information on the custom login buttons, see:
www.sourcecoast.com/jfbconnect/docs/common-support-questions

For the standard 'blue button', you can use the following code (which is what we use in the JFBCLogin module):
<fb:login-button v="2" onlogin="javascript:jfbc.login.login_button_click();">Reconnect Account</fb:login-button>

Finally, to make sure that the user isn't already logged into an account that's mapped to a Facebook account, you'll want to use the following PHP code to check:
require_once JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php';
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbId = $jfbcLibrary->getMappedFbUserId();
if (!$fbId)
   echo '<fb:login-button v="2" onlogin="javascript:jfbc.login.login_button_click();">Reconnect Account</fb:login-button>';

Hope that helps, but if you have any other questions, just let us know.

Thanks,
Alex
The topic has been locked.