I'm using the Comment social plugin in a facebook application using the code below
<div class="fb-comments" data-href="<?php echo $fbconfig['appBaseUrl']; ?>" data-num-posts="20" data-width="480"></div>
Where $fbconfig['appBaseUrl'] is my facebook app url (http://apps.facebook.com/[appname])
When users post a comment, the comment shows on the time line with his comment but also with this exception :
"Uncaught Exception: 100: null does not resolve to a valid user ID"
I've tried using the open graph debugger but no more information is provided, except for the 206 response code
http://developers.facebook.com/tools/debug/og/object?q=apps.facebook.com%2Fmesresolutions
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<br><b>Fatal error</b>
</head>
<body><p>: Uncaught Exception: 100: null does not resolve to a valid user ID
thrown in <b>/home/kastelni/www/facebook/mesresolutions/fb/base_facebook.php</b> on line <b>708</b><br></p></body>
</html>
Do you know what's wrong with my app or with the plugin ? Need some help ;)
Thank you for your help ! Yann
Found the solution.
I was testing if the current user was a fan of my application. But it is not possible to do so if this is the first connection a a user.
For those who are interrested in a piece of code:
$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
array(
//'scope' => 'email,publish_stream,user_birthday,user_location,user_work_history,user_about_me,user_hometown'
'scope' => 'user_about_me'
)
);
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
$user_perm = $facebook->api('/me/permissions');
} catch (FacebookApiException $e) {
//you should use error_log($e); instead of printing the info on browser
//d($e); // d is a debug function defined at the end of this file
$user = null;
}
}
try
{
if(isset($user_profile['id']))
{
//Est-ce que l'utilisateur est FAN
$isFan = $facebook->api(array(
"method" => "pages.isFan",
"page_id" => $fbconfig['pageId'],
"uid" => $user_profile['id']
));
}
else
$isFan = 0;
}
catch(Exception $o){
$isFan = 0;
}