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 |
Jump to:
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
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
Automatically closed -- issue fixed for two weeks with no activity.
#3
In case anyone is interested, I've posted to have someone implement this functionality.
http://www.elance.com/job?jobid=18336358
#4
#5
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' => markupapproach.