Topic-icon Jfbconnect not detecting Community Builder

Support Specialist
13 years 10 months ago #24658 by alzander
To get the token, you should be able to do:
$fbClient = $jfbcLibrary->getFBClient();
$token = $fbClient->getPersistentData('access_token', null);
However, if all you're trying to do is get the user's name and FB ID only, the following code can be used instead of all of the code you have above:
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $jfbcLibrary->getFbUserId(); 
$fields = array(0 => 'first_name', 1 => 'last_name', 2 => 'email', 3 => 'name');
$profile = $jfbcLibrary->getUserProfile($fbUserId, $fields);
$name = $profile[3];

If you're trying to do the raw curl requests, you're doing way too much work. JFBConnect wraps those functions for you to make the calls much, much easier, as you can see in the example above.

Hope that helps,
Alex
The topic has been locked.
Support Specialist
13 years 10 months ago #24659 by alzander
Also, you should really be using the Joomla database calls from JDatabase which will instantiate everything for you instead of having to do it yourself:
$dbo = JFactory::getDBO();
$dbo->setQuery("INSERT INTO jmzr4_m_users (facebook_id,name) VALUES('$user_facebook_id','$user_name')");
$dbo->query();
Much cleaner, more efficient, and uses the Joomla framework.

Good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 10 months ago #24732 by rajkum
Hi Alex,

This code is not working.

$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();

$fbUserId = $jfbcLibrary->getFbUserId();

$fields = array(0 => 'first_name', 1 => 'last_name', 2 => 'email', 3 => 'name');

$profile = $jfbcLibrary->getUserProfile($fbUserId, $fields);

$name = $profile[3];

Can you please specify where exactly i need to add this code.

Please reply ASAP. I will appreciate your quick reply.

Thanks
Rajneesh
The topic has been locked.
Active Subscriptions:

None
13 years 10 months ago #24733 by rajkum
I added the above code in login() function.

Thanks
Rajneesh
The topic has been locked.
Active Subscriptions:

None
13 years 10 months ago #24741 by rajkum
Hi Alex,

When the user login with facebook and after successful login, it change the button to Logout button and with greetings.Can you please tell me which function do this functionality and exactly which code do this, i need to add some code there.

Thanks
Rajneesh
The topic has been locked.
Active Subscriptions:

None
13 years 9 months ago #25584 by rajkum
Hi Alex,

JfbConnect is working perfectly in terms of its functionality like login with facebook and storing data into community builder. But when i place Login with facebook button on my following website, it gives me a cross browser issues, sometimes button show up and sometimes does not.On Firefox and Chrome its success rate is 80 to 90 percent, but on Safari and IE browsers most of the time it does not show up. For your reference i am giving you the link of my website where i have installed this plug-in. This website will be used by thousand of users and its very important for me to solve this problem asap.

This button is placed on the top right corner near the lauguage section.Whenever the user click any language of preference, login button should appear .


tracautomation.vicp.net/anayousvn/index.php/en/

I will appreciate if you will provide a quick reply.

Thanks
Rajneesh
The topic has been locked.
Support Specialist
13 years 9 months ago #25601 by alzander
Rajneesh,
First off, the SSL certificate for that site is invalid. The site doesn't seem accessible over http, so I can't test that way. That is possibly part of the problem, and something that looks very bad to the visiting users.

As for the most likely cause, if you open the HTML on your page, there are multiple inclusions of the Facebook Javascript library. Simply search for "all.js" in the HTML and you'll see. That should only be in the source code one time. More than that will cause erratic behavior in different browsers as it will be initialized in different order depending on multiple factors.

Remove those extra inclusions of the all.js file and you should be good to go. I'd still highly recommend fixing your SSL certificate as well.

Alex
The topic has been locked.
Active Subscriptions:

None
13 years 9 months ago #25683 by rajkum
Hi Alex,

Thanks for your quick reply. Actually this domain is just for testing purpose. I keep only one all.js and deleted the rest.It is working fine now on all the browsers as i mentioned.But when i click the Arabic language button other than (English and French) it shows me the Login with Facebook button in English. I want this to be appear in Arabic Language.

Please provide a reply ASAP as my deadline to deliver this project is very near. I appreciate your time and help.

Thanks
Rajneesh
The topic has been locked.
Support Specialist
13 years 9 months ago #25686 by alzander
It's likely that the language locale you are using for Arabic simply isn't supported by Facebook. You can see the supported locales in the XML file below:
www.facebook.com/translations/FacebookLocales.xml

Make sure you're using one of those for the Arabic language. If not, you can use the Facebook Locale Override setting in the Configuration -> Facebook API area to set one that will work for your locale.

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

None
13 years 9 months ago #25690 by rajkum
Hi Alex,

As you mentioned below in your previously reply.Can you please elaborate it more clearly. do i need to change this in my facebook app settings or JFBConnect source code.

If not, you can use the Facebook Locale Override setting in the Configuration -> Facebook API area to set one that will work for your locale.

Thanks
Rajneesh
The topic has been locked.