Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I was hoping for some insight as to how I should go about getting my Fan Page friend count to display on my Drupal driven site.

Are there any good tuts out there?

Any help would do

Thanks!

share|improve this question

2 Answers

up vote 1 down vote accepted

Mind you I have the Drupal for Facebook module installed. So this is what I did:

function facebook_count($username) {
$url = "https://graph.facebook.com/".$username;
$fbData = json_decode( file_get_contents( $url, 0, null, null ), true );
return intval($fbData['likes']);
}

I then displayed it via:

<?php echo number_format(facebook_count('Fan_Page_ID') ); ?>

Hope this helps!

share|improve this answer

It's a non-drupal thing. When you login in your facebook fan page, you find instructions to style and get copy n' paste Javascript/iframe code to put a "fan box" or a "like box" in your web pages: http://developers.facebook.com/docs/reference/plugins/like-box/

share|improve this answer
Well I understand that. What I am looking to display on my site is just a count of friends that I have or likes to my fan page. – TikaL13 Aug 31 '11 at 18:37
Sorry, misunderstood – Cheope Sep 13 '11 at 0:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.