Hello,
I never created a facebook app before and can't figure out now how to do this with this module.

All I want is to show a list of my facebook friends on a single page.

Up to now I did the following:
1. Installed and enabled "drupal for facebook" module
2. Created a facebook app "FriendList" on facebook.com
3. Added the app at "admin/build/fb/fb_app_create"

But...where can I define what the app does?

On the facebook application site there is an example code which seems to do exactly what I want:

// Copyright 2007 Facebook Corp.  All Rights Reserved. 
// 
// Application: FriendList
// File: 'index.php' 
//   This is a sample skeleton for your application. 
// 

require_once 'facebook.php';

$appapikey = 'xxx';
$appsecret = 'yyy';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

// Greet the currently logged-in user!
echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";

// Print out at most 25 of the logged-in user's friends,
// using the friends.get API method
echo "<p>Friends:";
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
foreach ($friends as $friend) {
  echo "<br>$friend";
}
echo "</p>";

Where have I to put this code to? Do I need to develop a new module?

Please point me to the right direction, thanks!

Greetz haggis

Comments

haggins’s picture

I tried to put the above example code into a node with php-filter:

require_once 'sites/all/modules/fb/facebook-platform/php/facebook.php';
$appapikey = 'xxx';
$appsecret = 'yyy';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

// Greet the currently logged-in user!
echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";

// Print out at most 25 of the logged-in user's friends,
// using the friends.get API method
echo "<p>Friends:";
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
foreach ($friends as $friend) {
  echo "<br>$friend";
}
echo "</p>";

But when I view the node I get redirected to facebook login form. After login I get redirected to my facebook home site. What did I miss?

Dave Cohen’s picture

Start with the README.txt. Then read the module docs on drupal.org. Search drupal.org for instructions on how to create a Drupal module.

After configuring Drupal for Facebook, there will be a global variable, $_fb. Use that rather than calling new Facebook(...).

haggins’s picture

Hi Dave,
I did follow the README.txt step by step and I don't think I missed anything.

I also tried this:
- registering my site at http://developers.facebook.com/setup
- adding the resulting app to my drupal site
- creating a like-box at http://developers.facebook.com/docs/reference/plugins/like-box
- adding the XFBML to a block with "FullHTML"-filter

=> nothing appears though there is xmlns:fb="http://www.facebook.com/2008/fbml" at my tag and "/sites/all/modules/fb/fb_connect.js" included.

The only way I got the likebox working is the iframe-version which doesn't need any modifications at my site:

<iframe frameborder="0" scrolling="no" src="http://www.facebook.com/plugins/likebox.php?api_key=1234&connections=100&header=true&height=700&id=9876&locale=de_DE&sdk=joey&stream=true&width=150" allowtransparency="no" style="border:none; overflow:hidden; width:150px; height:700px; background-color: #FFF;"></iframe>
13rac1’s picture

Status: Active » Closed (works as designed)

6.x-2.x is deprecated. Closing old issue.