Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Update the facebook Information component to display basic informatio…
Browse files Browse the repository at this point in the history
…ns (firstName, lastName, mail, number of friends)
  • Loading branch information
Charles Flond committed May 9, 2011
1 parent 92d1617 commit 96a7a42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/jahia/modules/facebook/FacebookUtil.java
Expand Up @@ -5,6 +5,7 @@
import com.restfb.FacebookClient;
import com.restfb.types.User;
import org.jahia.services.SpringContextSingleton;
import org.jahia.services.usermanager.JahiaFacebookUser;
import org.jahia.services.usermanager.JahiaUser;
import org.jahia.services.usermanager.JahiaUserManagerFacebookProvider;

Expand Down Expand Up @@ -50,11 +51,11 @@ public static String getPermissionList() {

public static int getFriendsNumber(JahiaUser jahiaUser)
{
if(jahiaUser != null)
if(jahiaUser != null && jahiaUser instanceof JahiaFacebookUser)
{
String access_token = jahiaUser.getProperty("access_token");

if(!access_token.isEmpty())
if(access_token != null)
{
//Get the Facebook Client
FacebookClient facebookClient = new DefaultFacebookClient(access_token);
Expand Down
Expand Up @@ -25,9 +25,12 @@
<%--@elvariable id="currentResource" type="org.jahia.services.render.Resource"--%>
<%--@elvariable id="url" type="org.jahia.services.render.URLGenerator"--%>

<div style="width: 850px; border: medium dotted; padding: 10px;">
<div style="width: 250px; border: medium dotted; padding: 10px;">

Friends Number : ${fbUtil:getFriendsNumber(renderContext.user)}
<img src="https://graph.facebook.com/${renderContext.user.username}/picture" style="float:left;margin-right:10px;"/>
${renderContext.user.properties["j:firstName"]}&nbsp;${renderContext.user.properties["j:lastName"]}<br/>
Friends Number : ${fbUtil:getFriendsNumber(renderContext.user)} <br/>
Email : ${renderContext.user.properties["j:email"]}

<%--
<c:choose>
Expand Down

0 comments on commit 96a7a42

Please sign in to comment.