Topic-icon EasySocial Facebook connected profiles import

Active Subscriptions:

None
Hey guys, I have a problem, my site has been using EasySocial's Facebook connect as the only login option, so our members don't know their username nor password. I tried to use JFBConnect and it created a new account for me, instead of loging me on. Is there any way to import the already registered users?
The topic has been locked.
Support Specialist
11 years 11 months ago #44994 by alzander
Right now, there's not a way to import the previous connections that have been made in EasySocial to JFBConnect. However, that should actually be pretty easy to add as we have the functionality to import connections, just not for EasySocial yet.

We do have a setting for "Automatically link users by email". If that is enabled, and the user is logging in through Facebook, their email should from Facebook should be the same one as in your Joomla site already.. and in that case, JFBConnect will connect the 'new' Facebook user to the existing Joomla user.

I hope that helps explain a good option for you to try now. If you'd like us to investigate the importing of existing connections, just let me know, it should only take a few days.

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

None
11 years 11 months ago #44998 by statusselect
Ah, as the main site I am using this in is in beta and has limited members, I went back and changed their e-mails to their facebook default e-mails. It seems to be working so far. That said, I have another bigger site I am considering using JFBConnect on which runs on EasySocial and there it definitely would be nice with a way to migrate the users. So maybe you could consider this for 6.1?
The topic has been locked.
Support Specialist
11 years 11 months ago #45007 by alzander
We have some code to test that works for us, and should for you as well. If you're interested in trying it out for importing existing EasySocial connections into JFBConnect, you'll need to edit the /plugins/socialprofiles/easysocial/easysocial.php file. In that file around line 39, you'll see:
//$this->_importEnabled = true; // This plugin has a method to transfer existing facebook connections over to JFBConnect
    }
You'll want to remove the 2 // lines at the beginning of that line and then add some additional code below it for the import functionality. When done, it should look like:
$this->_importEnabled = true; // This plugin has a method to transfer existing facebook connections over to JFBConnect
    }

    public function jfbcImportConnections()
    {
        // Get original EasySocial connections
        $query = 'SELECT * FROM #__social_oauth WHERE `client`="facebook" AND `type`="user"';
        $this->db->setQuery($query);
        $esConnections = $this->db->loadObjectList();
        $userMapModel = JFBCFactory::usermap();

        foreach ($esConnections as $es)
            $userMapModel->map($es->uid, $es->oauth_id, 'facebook', $es->token);
    }

    public function socialProfilesGetRequiredScope($network) <---- this line is already there
Once that's done, go to the JFBConnect -> Usermap area and click the "Import Connections" button and follow the instructions.

As always with new code, we highly recommend backing up your database, just in case. The code above will not alter the EasySocial tables in any way. It will add any new connections between a Joomla user and Facebook in the JFBConnect tables or update any rows that already are in that table.

Please keep us informed on how that goes, and best of luck!

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

None
11 years 11 months ago #45019 by statusselect
Sweet, it seems to have worked. I will confirm when one of the newly imported users tries to log on. But in terms of the usermap it has been populated! Thanks a lot guys, I really appreciate it!
The topic has been locked.
Support Specialist
11 years 11 months ago #45023 by alzander
Awesome. As mentioned, we did some testing and it should work. In the Usermap area, if things were populated and links to the user's Joomla details work, then the authentication should work for that user as well.

Definitely keep us posted and I'm glad we could get you something to help out.

Finally, if you haven't already, please consider leaving a rating and review for JFBConnect, or our support, on the Joomla Extension Directory. It certainly isn't required, but is very appreciated:
extensions.joomla.org/extensions/social-...ook-integration/7215

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

None
11 years 11 months ago #45026 by statusselect
I can confirm, it definitely worked... and considering you took the time to add that code, I will take the time to write a nice JED review :D
The topic has been locked.
Active Subscriptions:

None
11 years 11 months ago #45027 by statusselect
A very positive review has been submitted to review on JED :)
The topic has been locked.
Support Specialist
11 years 11 months ago #45030 by alzander
That's fantastic news. Thanks so much for your feedback on what you needed and your results with the change. The update will be in the 6.1.1 release of JFBConnect. 6.1.0 is right around the corner, and we don't want to make any more changes to it. Of course, you likely won't need to run the code anymore, but in case you do.. it will be included soon.

Thanks so much for the positive review. We can't wait for it to be published to read it.

As always, if you need anything else, just let us know!

Alex
The topic has been locked.