Facebook Cookbook - Jay Goldman [85]
invite
bool
false
Set to true to send an invitation, and false to send a request. This will affect the action button on the form and the format of the notification sent to the recipients.
method
string
get
Set to either get or post as you would with any HTML form. Depending on how many friends your user selects, there can be a lot of parameters in the URL and you can send them to URLs off Facebook, in which case post is probably a better choice for security reasons (it will hide all of the Facebook IDs of their selected friends). Then again, this isn’t an HTTPS connection, so it’s not all that secure either way.
action
string
N/A
The URL to send users to after they complete the form. This can be on- or off-Facebook, and it will receive two GET or POST variables (depending on what you specified for the method parameter): typeahead and ids (an array). See the rest of the Discussion for details.
The choice of which control to put in your fb:request-form depends on what you plan to use it for.
Inviting/requesting friends in bulk
Use the fb:multi-friend-selector in either full or condensed modes. The page identified in the fb:request-form’s action parameter will receive a GET or POST parameter called ids, containing an array of the Facebook IDs of the friends selected by the user. fb:multi-friend-selector’s parameters are listed in Table 6-19.
Table 6-19. Parameters for fb:multi-friend-selector
Name
Type
Default value
Full
Condensed
Description
actiontext
string
N/A
•
Title text displayed above the full version. This is required for the full version.
condensed
bool
false
•
Triggers condensed mode when set to true. This is required for the condensed version.
max
int
The number of remaining friend requests
•
•
The maximum number of friends the user can invite, ranging from 1 to 35. Facebook will automatically cap this at the number of remaining daily friend requests this user has in your app.
exclude_ids
array
N/A
•
•
Comma-separated list of IDs that should be excluded. See later in the Discussion for code to remove friends who already have your app.
bypass
string
skip
•
Choose the text you want listed on the skip button. Options are skip, step, and cancel, which will render “Skip”, “Skip This Step”, or “Cancel”, respectively. Anything other than those three values will default to skip, and there’s no way to set the top and bottom bypass buttons individually.
rows
int
5
•
The number of rows of friends to show in the selector without scrolling (i.e., the height of the box in rows). Any whole integer between 3 and 10 is allowed.
showborder
bool
false
•
Turns on a 10-pixel-wide light blue border with one pixel of darker blue on the inside edge, all the way around the selector.
unselected_rows
int
6
•
Number of rows of friends to display in the “unselected” part of the control. Whole integers between 4 and 15 are allowed.
selected_rows
int
5
•
Number of rows of friends to display in the “selected” part of the control. Whole integers between 5 and 15 are allowed, or set this to 0 to get a single box for “unselected” and “selected.”
If you’re using this tag to provide your users with a mechanism to invite their friends into the application, you might want to consider using exclude_ids to exclude friends who already have the app installed. Some relatively simple PHP code and FQL will give us back a list of who belongs in that group and will parse it into a comma-separated list for use in the tag (this is original code by the developers of PickPocket, from http://wiki.developers.facebook.com/index.php/Fb:request-form):
global $api_key, $secret;
$facebook = new Facebook($api_key, $secret);
$user = $facebook->require_login();
// Use FQL to find the list of users who have installed this