Facebook Invite All Friends is used to invite friends to start using an application without requiring for manual selection in step 50 by 50.
It is implemented in 3 forms: as a button, as a link or as an image, on which user has to click to open the request dialog.
There is also an option to open it automatically on page load.
Facebook Invite All Friends Image
Following image represents the Facebook Invite All Friends. Names are hidden, because of privacy protection.
PHP Example
The example shows default Facebook Invite All Friends, which is shown on picture above. The example shows the code of whole page, but important content is highlighted: required includes and initialization for any page with brown color, and working with Facebook Request Dialog PHP class with blue color.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Facebook Invite All Friends PHP Example</title>
</head>
<body>
<?php
require_once 'facebook.php';
require_once 'faceconn/faceconn.php';
UseGraphAPI();
$invite = new InviteAllFriends();
$invite->SetMessage("Try Facebook Connect PHP Toolkit");
$invite->Render();
?>
</body>
</html>
Facebook Invite All Friends PHP class has a demo page inside Demo Website where it can be seen how it works. The most important fact is that the Demo website is contained in package with Facebook Connect PHP Toolkit which is very useful resource of code examples for each control from the toolkit. Look at the
Facebook Invite All Friends Demo page.
Configuration
Configuration of the Invite All Friends PHP class is done through calls of the setter methods, which in turn set the private properties. For Facebook Invite All Friends PHP class, there is one required property to set and others are optional. All you have to do is to create new instance of the class, set the message, and call Render() method.
Method Name
Type
Description
SetMessage
String
Function sets the message of the request dialog.
SetTitle
String
Function sets the title of the request dialog.
SetAdditionalData
String
Function sets the additional data of request dialog.
SetFriendId
String
Function sets the friend ID. If it's set, the request will be sent just to this friend.
SetCommandType
String
Function sets the type of the command control. Allowed values are 'link', 'button', 'image' and 'auto'. Default value is 'button'.
SetCommandText
String
Function sets the title of a request button/link. Default value is 'Send Request'.
SetCssStyle
String
Function sets the CSS style of the button/link.
SetCssClass
String
Function sets the CSS class of the button/link.
SetFilters
String
Function sets the filters of the request dialog.
SetRedirectUri
String
Function sets the redirect URI of the request dialog.
SetImage
String
Function sets the image of the button. Image type is set automatically.
SetOnSendRequestJavaScript
String
JavaScript code which will be executed after request is sent. List of invited friends IDs is stored in invitedFriends JavaScript variable.
SetOnSendRequestSubmitForm
String
Form which will be submitter after request is sent. After form is submitter, list of invited friends IDs is stored in $_GET["invitedFriends"].
SetNextDialogTitle
String
Function sets title of invite next friends dialog. Default value is 'Invite more friends ...'
SetNextDialogNumbers
String
Function sets numbers of invite next friends dialog. Default: Invites were sent to first {0} out of {1} of your friends.
SetNextDialogContinueLabel
String
Function sets continue label of next friends dialog. Default: Continue with sending to next 50 friends ..
SetNextDialogContinueButton
String
Function sets text of continue button inside next friends dialog. Default: Continue.
SetNextDialogCancelButton
String
Function sets text of cancel button inside next friends dialog. Default: Cancel.