Topic-icon using JFBC and Jlinked as ID verification

Active Subscriptions:

None
13 years 3 weeks ago - 13 years 3 weeks ago #33248 by davlar
Hi - don't know if you have ever used AirBnB. They use facebook and linkedin profile connection as a part of their identity verification steps. Effectively you gain trust in their community if you have linked up your fb profile - because it shows you are not so weird as to have no friends, that you previously held down a job, that you actually exist, etc.

I would like to do this for my users, as trust is very important on my site. Could you possibly suggest a code snippet I could drop into jomsocials profile.index.php that checks if the users has connected via jfbc or jlinked and if so echos something like "Facebook Profile Verified (333 Friends) | LinkedIn Profile Verified (200 Contacts)"?

Very many thanks in anticipation of your help with this.
Last edit: 13 years 3 weeks ago by davlar.
The topic has been locked.
Support Specialist
13 years 3 weeks ago #33251 by alzander
Getting the status if the user has logged in / connected with Facebook or LinkedIn is pretty easy and I can get you that code. Getting their friend or connection count would likely be more difficult. I'm not sure that that's public information that can be queried on any page load.. so, either it would have to be stored in your database when the original user logs in, or you'd need to query it in real-time and make sure you have permission from the user to do so.

As for getting the connection, the code for Facebook would be like:
<?php
$fbUserMap = JFBConnectModelUserMap::getUser('123');
if ($fbUserMap->_data->fb_user_id != null)
  echo "User connected via Facebook";
else
  echo "nope, they didn't";
?>
You'll have to get the ID of the user that is being looked at and replace that in the 123 above. The code hasn't been directly tested, but should work.. obviously, test. Once you get that going, we can work on LinkedIn :)

Let me know how that goes, and good luck!
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 2 weeks ago #33262 by davlar
Thanks - excellent support as ever.

I am a little confused as to how to get the JFBC user. Jomsocial has the user defined in
$user
so you can call the name for example with
$user->getDisplayName();
or a custom profile field with
$user->getInfo('XIPT_PROFILETYPE');
. Jomsocial and joomla user manager share the user ID. But JFBC uses it's own user ID in the usermap. Any thoughts?

In terms of number of uses I would be happy to take the number from the first profile import and store that in database. It can then be displayed as "More than XX Friends" - good enough. What do you think.
The topic has been locked.
Support Specialist
13 years 2 weeks ago #33266 by alzander
The id we use for that call is the Joomla User ID, so when you call JFBConnectModelUserMap::getUser('123'), just enter the JomSocial user ID from the profile.

If you have any issues though, let me know, and no problem for the support. It's what we do :D

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

None
13 years 2 weeks ago #33306 by davlar
OK - that's great. Got the facebook part working well. The code in userinfo.php now looks like this:
<div id="identity">
                <h5>ID Verification</h4>
                <ul>
                <?php 
$fbUserMap = JFBConnectModelUserMap::getUser($id); 
if ($fbUserMap->_data->fb_user_id != null) 
  echo '<li style="font-size:12px; color:#333"><span class="fbverified">f</span> Facebook verified</li>'; 
else 
  echo '<li style="font-size:12px; color:rgba(102,102,102,0.5)" ><span class="fbverified">f</span> Facebook not verified</li>';
    echo '<li style="font-size:12px; color:rgba(102,102,102,0.5)" ><span class="linkedinverified">in</span> LinkedIn not verified</li>'; 
 
?>
                </ul></div>


All I need now is the linkedin version and some tips on importing and storing the number of friends. i tried replacing $fbUserMap with $jlinkedUserMap etc. but it didn't work. Any advice?
The topic has been locked.
Active Subscriptions:

None
13 years 2 weeks ago #33326 by davlar
hi - any thoughts on this?
The topic has been locked.
Active Subscriptions:

None
13 years 2 weeks ago #33327 by davlar
hi - any thoughts on this?
The topic has been locked.
Active Subscriptions:

None
13 years 2 weeks ago #33342 by davlar
bump - sorry - any guidance on this?
The topic has been locked.
Support Specialist
13 years 2 weeks ago #33348 by alzander
Sorry for the delays. Been a busy few days around here. The code for getting if the user has 'linked' is:
$liMemberId = JLinkedModelUserMap::getMemberId($joomlaId);

The biggest issue is the connections. I'm looking into the best way to get that number for a user. If the current user was logged in using JFBC or JL, the answer wouldn't be that difficult. The problem is that the user may be a guest or Joomla-only registered user, in which case we'd have to query that info differently.

One thing to note is that, with JLinked at least, there is the option to import "Number of Connections" into the user's profile. You could import that into the user's JomSocial profile when they register and then show that in their profile. We don't have a similar option for JFBConnect to import friend count right now, and I'm not sure how easy that will be to get.

I hope that helps, but if not, let me know.

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

None
13 years 2 weeks ago - 13 years 2 weeks ago #33363 by davlar
thanks. I tried this following your example but no cigar:
$liMemberId = JLinkedModelUserMap::getMemberId($id); 
if ($JLinkedModelUserMap->_data->li_user_id != null) {
 echo '<li style="font-size:12px; color:#333"><span class="linkedinverified">in</span>LinkedIn not verified<![if !IE]>✓<![endif]>
<!--[if gt IE 6]>✓<![endif]-->
<!--[if lt IE 7]><div style="font:bold 1.2em "wingdings 2"; text-align: center;">P</div><![endif]--></li>'; 
}
elseif ( $isMine) {
    echo '<li style="font-size:12px; color:rgba(102,102,102,0.5)" ><span class="linkedinverified">in</span>LinkedIn not verified<br/><a //href="javascript:void(0)" onclick="jlinked.login.login();">Verify now!</a></li>'; 
}
else {
	  echo '<li style="font-size:12px; color:rgba(102,102,102,0.5)" ><span class="linkedinverified">in</span>LinkedIn not verified</li>';  

}

I get the error:

Notice: Undefined variable: JLinkedModelUserMap in /components/com_community/templates/default/modules/profile/userinfo.php on line 92

Notice: Trying to get property of non-object in /components/com_community/templates/default/modules/profile/userinfo.php on line 92
Last edit: 13 years 2 weeks ago by davlar.
The topic has been locked.