Download & Extend

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

Project:Drupal for Facebook
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

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.

Comments

#1

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

Status:fixed» closed (fixed)

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

#3

Category:support request» feature request
Status:closed (fixed)» active

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' => markup approach.

#6

A complete hack that I cobbled together based on the userreference module's auto complete and Dave's suggestion. I'm sure there are so many things wrong with this, but it's working for me.

AttachmentSize
dff_widget.zip 1.43 KB

#7

Status:active» closed (won't fix)

Since Drupal 5 is no longer supported, I'm taking the liberty to close all FB D5 issues. Issues that haven't moved since D5 are unlikely to still be valid.

nobody click here