How do I use fb:friend-selector in content creation?

Darren Phillips - March 30, 2008 - 04:33
Project:Drupal for Facebook
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi there,

I've been trying to figure this out but no luck so far.

I'm using CCK to add various fields to a custom content type that users of the facebook app can create. I want one of those fields to be the (http://wiki.developers.facebook.com/index.php/Fb:friend-selector). I've tried creating a CCK custom field/widget module but those hooks need to return something for the From API not html/fbml.

I could use a regular list and populate it with PHP and the Facebook API but that would be nowhere near as nice.

Any suggestions?

Thanks.

#1

Dave Cohen - March 30, 2008 - 22:29
Status:active» fixed

In the long run, it would be cool define a friend selector form element for drupal. Something like

$form['friends'] = array('#type' => 'friendselector',
...
);

And that would produce fbml in canvas pages, and something else on regular pages. It could even be made open-social aware. But this is all a long way off.

In the meantime, take advantage of drupal's FAPI flexibility. Do something like this:

$form['friends'] = array('#type' => 'markup', '#value' => '<fb:friend-selector uid="12345" name="uid" idname="friend_sel" />');

It will only work on canvas pages.

#2

Anonymous (not verified) - April 13, 2008 - 22:31
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#3

ahansen1 - November 5, 2009 - 01:20
Category:support request» feature request
Status:closed» active

In case anyone is interested, I've posted to have someone implement this functionality.

http://www.elance.com/job?jobid=18336358

#4

ahansen1 - November 5, 2009 - 02:41

#5

Dave Cohen - November 13, 2009 - 19:01

Does this help: http://drupal.org/node/631216

I realize you're asking for something different, but that page documents a working use of multi-friend-selectors.

See the code in fb_form.module. Specifically fb_form_theme() and theme_fb_form_multi_friend_selector(). This code should allow you to include in your forms

<?php
$form
['whatever'] = array(
 
'#type' => 'fb_form_multi_friend_selector',
 
// etc...
);
?>

Possibly, fb_form.module needs to include support for other friend selectors and (X)FBML tags.

In a pinch your $form data structure can include arbitrary FBML...

<?php
$form
['whatever'] = array('#type' => 'markup', '#value' => '<fb:friend-selector ...></fb:friend-selector>');
?>

Oh wait... just noticed this issue is 5.x. In that case, try the '#type' => markup approach.

 
 

Drupal is a registered trademark of Dries Buytaert.