MyBB Community Forums

Full Version: FaceBook and Twitter connect?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I searched through the mods site but was unable to find anything.

Are there any plugins that provide FaceBook and Twitter connect?
Facebook: http://www.mybbaddons.com/board/thread-1306.html - You need to be a subscriber.

I don't know about Twitter.
I notice that these are all from either a year or two ago, do you think they still work properly with the newest version of MyBB? I suppose I'll give them a try on a test board and see how well they work.
I think that they are updated.
Far as I know the mybbaddons one (or one like it) was removed from the mod section because of a security risk that was left unfixed..(sorry I don't have the source link, read it here last week). I've been looking for the same kind of mod for a while now. I haven't seen the twitter tutorial that Nathan linked for you before so I'm checking it out now and it looks awesome, but most people use google and facebook in my site demographics so we'll see. In my opinion I suggest you be cautious using plugins hosted outside of this forum like in the other link.

Edit 1:
Oh great, I've read through that twitter connect thread... it requires SQLite which needs to be installed on your server... why this is required doesn't make sense to me... so for me.. no go on that twitter connect tutorial.
Quote:know the mybbaddons one (or one like it) was removed from the mod section because of a security risk that was left unfixed..

FB plugin from mybbaddons is a paid one and it's not avaible on mods site,the plugin that you are referring to is Fbconnect by nayar.
There is some open source kinda check http://ulogin.ru/ (Russia but you can understand what to do there...) if there only was a way to take like joomla plugin and transform it to MyBB...

The work of this plugin on joomla you can see on my site http://www.videoculinary.ru/ (after some tweaks cos of duplicated user creation)

here is the code anyway (joomla)

<?php

/**

* @package uLogin

* @copyright (c) 2011-2012 uLogin

* @license GNU/GPL3

*/

defined('_JEXEC') or die('Restricted access');

jimport('joomla.user.helper');



if (isset($_POST['token'])) { 

	$s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);

	$data = json_decode($s, true);

	if (isset($data['uid'])) {
		
		$user_email = ($data['email']); //Email from network
		
		$conn = mysql_connect('localhost', '***', '***') or die(mysql_error()); //db conn
		
		$query = "SELECT * FROM `***`.`***` WHERE (CONVERT(`email` USING utf8) LIKE '%$user_email%') LIMIT 0 , 1"; //search email
		
		$result = mysql_query($query) or die(mysql_error());
		
		while($array = mysql_fetch_array($result)) { //set array
		
			$user_id = ($array[0]); //get id by email
			break;
			
		}; 
	
		
		if (!$user_id) { //if no id (no email) in db
		
		    $user_id = JUserHelper::getUserId($data['first_name'] . ' ' . $data['last_name']); //set id by user name by network

			$com_user = JComponentHelper::getParams('com_users');

			$group = $com_user->get('new_usertype');

			$acl = &JFactory::getACL();

			$date = JFactory::getDate();

			$instance = JUser::getInstance();

			$instance->name = $data['first_name'] . ' ' . $data['last_name'];

			$instance->username = $data['first_name'] . ' ' . $data['last_name'];

			$instance->email = $data['email'];

			$instance->password = JUserHelper::getCryptedPassword(JUserHelper::genRandomPassword());

			$instance->usertype = $group;

			if (method_exists($acl, 'get_group_id')) $instance->gid = $acl->get_group_id('', $group);

			else $instance->groups = array($group);

			$instance->registerDate = $date->toMySQL();

			$instance->guest = false;

			$i = 0;

			$email = explode('@', $data['email']);

			$instance->save();

			while (!$instance->save()) {

				$i++;

				$instance->email = $email[0] . '+' . $i . '@' . $email[1];

			}

		} else $instance = JUser::getInstance($user_id);

		$session = &JFactory::getSession();

		$instance->guest = 0;

		$instance->aid = 1;

		$session->set('user', $instance);

		$instance->setLastVisit();

		echo '<script type=text/javascript>window.location.href=window.location.href;</script>';

	}

} else {

	$user = &JFactory::getUser();

	global $ulogin_counter;

	$ulogin_counter++;

	if ($user->get('guest')) {

		$instance = &JURI::getInstance();

		if($ulogin_counter==1) echo '<script src="http://ulogin.ru/js/ulogin.js"></script>';

		echo		'<div id="uLogin" x-ulogin-params="display=panel;fields=first_name,last_name,email;providers=odnoklassniki,vkontakte,twitter,mailru,facebook,yandex,google;hidden=;redirect_uri=http%3A%2F%2Fwww.videoculinary.ru%2F"></div>';

	}

}

basically you get "uid" "username" "name" "last name" "email" from the soci-net and process a fast registration...

hope it will help someone..
Been trying to translate http://ulogin.ru/ to english, do I understand right that this code simply fetches login details and inserted them into the registration forms?

EDIT:
Ok so I made it through roughly translating the site, here's what I have:
Embed to login page:
<script src="http://ulogin.ru/js/ulogin.js"></script>
<div id="uLogin" x-ulogin-params="display=panel;fields=first_name,last_name,photo;providers=facebook,google,twitter,youtube;hidden=steam,liveid,flickr,vimeo,linkedin,lastfm,soundcloud;redirect_uri=http%3A%2F%2F"></div>


Place the code at http://
$s = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
$user = json_decode($s, true);
//$user['network'] - soc. network through which a user is logged
//$user['identity'] - unique string defining a specific user soc. net
//$user['first_name'] - user name
//$user['last_name'] - last name

FAQs:
- Which fields are available for the profile?
- Available in the following fields: first_name - username, last_name - last name, Email - E-mail, nickname - a nickname, bdate - Date of Birth, Sex - sex, Phone - Phone, Photo - square avatar ( 100 * 100), photo_big - the biggest avatar, which is issued by the chosen soc. Network, City - City, Country - country.

- Is it possible to specify the optional fields?
- Yes. Optional fields are transmitted separated by commas in the parameter optional . Required fields are listed in the parameter fields

- What happens if the soc. the network will not give the required fields?
- user displays a form to fill in missing data.

- How to login without redirect?
- Add an attribute x-ulogin-params parameter callback function with the name that will receive the token after authorization. As redirect_uri pass the address file ulogin_xd.html on your server.

- Where can I get a file ulogin_xd.html?
- Download the archive at the link: ulogin_xd.zip and unzip the file ulogin_xd.html to the folder with your website.

- Can I use uLogin in 2 or more places on the page?
- Yes you can. All elements with an attribute x-ulogin-params uLogin create panel with the specified parameters

- How do I get when logging icon appears on my site?
- Write to us at [email protected] .

_____________________________________________________________

So I digged into ulogin.js and found as many files attached files as I could, please check if I missed one, there's a transparent.png but I think it's js generated and not an actual content url in the js.
[attachment=26169]

I also uploaded the vBulletin plugin from them, maybe someone can port it over will all files so no external calls are done to ulogin.ru
[attachment=26170]

Let's work on this and get it going! Smile

EDIT 2:
the http://ulogin.ru/token.php might need to be ripped some how.. and THIS does NOT look like open source ArieKatz... otherwise all these files wouldn't be dependent on ulogin.ru. There'd be ALL source files available for download.