× Joomla Facebook Connect support forum

Topic-icon A couple of problems with JFBConnect 3.0.2

Active Subscriptions:

None
13 years 6 months ago #5339 by asus
Hi,
I'm really happy with this new JFBConnect version, but I would like to address a couple of problems I've had with the latest release.

1)
The old issue with usernames chosen during registration being rewritten by Community Builder, when the "Username" option is set to "No" under "Configuration -> User Profile" in Community Builder, is still there.

The problem is that this call in com_jfbconnect/libraries/communitybuilder.php:
$cbUser->saveSafely($array, $ui, $reason);
somehow rewrites the username (it's CB doing here).

As a quick fix one could add this patch:
$dbo->execute("UPDATE jos_users SET username="
.$dbo->quote($jUser->username)
." WHERE id='{$jUser->id}'"
);
around line 95 in com_jfbconnect/libraries/communitybuilder.php

2)
Before this release of JFBConnect with the nice autologin feature, we implemented the same functionality with client side code, using cookies to keep track of some things, for instance when the user requested a logout, so that we could disable the autologin while still keeping the user logged in facebook.
For this thing to work, we needed the "Logout Redirection URL" feature that can be found in the module settings.
Unfortunately it seems to be broken in this release. It's not a big issue but it would be nice to have it back to work.

Thank you
The topic has been locked.
Support Specialist
13 years 6 months ago #5340 by alzander
Howdy! Thanks for the compliments on the upgrade, always good to hear that users are happy.

Regarding the first comment about CB, yeah, we've been getting a few questions about that lately. We really hadn't investigated before but are planning to have a solution for the 3.1 release due later this month (or early next). Thanks for the code that's working for you, it's always a great starting point to have.

As for the 2nd, yes, there's an issue. We moved the login redirection settings to the main component for multiple reasons, but the logout URL got left out. It will be fixed in the next release. If you need help working around the problem now, we can certainly help you.

Again, thanks for the feedback, and let us know if there's anything else you'd like us to improve on!
The topic has been locked.
Active Subscriptions:

None
13 years 6 months ago #5380 by asus
Hi,
I'm afraid I've another request :D

We wrote a custom php, meant to be called directly (without invoking the usual joomla index.php), which exploits the functionalities of an usual module, since it has a reference to the $mainframe (JFactory::getApplication('site')) stuff.

Before upgrading, we were able to call $mainframe->login() without any secondary effect, but now we get this block printed out:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
etc... etc...
</script>

which is written by com_jfbconnect/libraries/facebook.php:initJavascript().

The problem seems to be in plugins/user/jfbconnectuser.php, when the onLoginUser function gets the singleton of JFBConnectFacebookLibrary. In fact, when the class is instantiated it writes that <script></script> block.

Since this behaviour was different in previous releases, I think there may be a way to prevent this from happening.
I also don't think it's a good idea to print out things from the onLoginUser function of a plugin.
The topic has been locked.
Support Specialist
13 years 6 months ago #5386 by alzander
Yup, you've found our dirty little secret. In the next release, we're going to have a standalone javascript file which is included. That will prevent echo statements from the library, which, is not the best thing to be doing.

Our best, very easy fix suggestion is to make a quick modification to the following files:
/components/com_jfbconnect/libraries/facebook.php. In the getInstance function, add the loadJavascript parameter:
public static function getInstance($loadJavascript = true)
    {
        if (!isset(self::$libraryInstance))
        {
            self::$libraryInstance = new JFBConnectFacebookLibrary($loadJavascript);

Then, in the same file's contructor, change it to:
private function __construct($loadJavascript = true)
...
if ($loadJavascript)
       $this->initJavascript();

Finally, in the user plugin (/plugins/user/jfbconnectuser.php) at line 35, change the getInstance call to not load the Javascript:
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance(false);

Test, test, test. It's possible this could cause issues somewhere else, but hopefully not (mainly, when you're logging in, if you don't do a redirect, the JS won't be on the page).

Again, sorry for the troubles. This was planned to be corrected soon, but now that we know of an instance where it's a problem, that jumps it up in the priority.

Thanks, and let us know how the above works out!
The topic has been locked.