Mikeluby.com with FBC’s Comments

February 19th, 2009 | Categories: Facebook

Facebook has just launched their first social widget using their increasingly popular Facebook Connect platform. You can take a look at their recent blog post to explain it a little more. Facebook says that “Sites have seen as much as 40-50% more comments since they launched added these features.” and adding Facebook connect to a site is extremely easy.  I’m not going to go over how to implement Facebook connect right now (maybe later). Using a mix of the Facebook PHP API and Facebook connect you can totally replace your own blog’s comment system. I invite you to check out the comment system in action here.

Below the fold I’m going to paste a code snippet that will set you on your way.

FBML for comment box:


<fb:comments xid="mikeluby_POST_ID" reverse="true"></fb:comments>

Get the Number of comments:


require_once( "FBAPI/CLIENT/LOCATION/facebook.php" );
$appapikey = 'FB_API_KEY';
$appsecret = 'FB_SECRET';
$facebook = new Facebook( $appapikey, $appsecret );
$comments = count( $facebook->api_client->call_method( "facebook.comments.get", array( "xid" => "mikeluby_$post_id" ) ) );

Comments

TOP