Facebook Invite Friends class is used to send the invite requests to the user's friends, to use Facebook application or Facebook Connect website. There are two types of the invite control: a classic one and condensed one. This tutorial contains description of both controls, one after another.
Note: This feature is deprecated by Facebook. Please use Facebook Request Dialog instead.Facebook Invite Friends Classic
Invite Friends Classic Image
This image shows classic Facebook Invite control with default settings. Pictures of friends and last names are hidden, because of privacy protection. The picture shows the Invite control after the send button is pressed. Preview of invite request is shown too.
PHP Example
The example shows the configuration of default Facebook Invite Friends control, with only mandatory parameters being set. Action URL, Accept URL and application name are taken from AppConfig.php class, as default settings. 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 Invite Friends 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 Friends PHP Example</title> </head> <body> <?php require_once 'facebook.php'; require_once 'faceconn/faceconn.php'; UseGraphAPI(); $invite1 = new InviteFriends(); $invite1->SetMainTitle("Main title"); $invite1->SetContent("This is Facebook invite friends content."); $invite1->Render(); ?> </body> </html>
Configuration
Configuration of the Facebook Invite Friends PHP class is done through calls of the setter methods, which in turn set the private properties. There are couple of mandatory properties and couple of optional ones which are set by default. After the configuration is set, all you have to do is to call Render() method, and the control will display on page.
Setting mandatory properties
Setting optional properties
Facebook Invite Friends Condensed
Invite Friends Condensed Image
This image shows condensed Facebook Invite PHP class with default settings. Friends' last names are hidden because of privacy protection. The picture shows the Invite control before the send button is pressed. After it is pressed, the same invite friends request is shown, like for Facebook Invite Friends classic control.
PHP Example
The example shows the configuration of default Facebook Invite Friends control, with only mandatory parameters being set Action URL, Accept URL and application name are taken from AppConfig.php class, as default settings. 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 Invite Friends 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 Friends PHP example</title> </head> <body> <?php require_once 'facebook.php'; require_once 'faceconn/faceconn.php'; UseGraphAPI(); $invite2 = new InviteFriendsCondensed(); $invite2->SetContent("Content"); $invite2->Render(); ?> </body> </html>
Configuration
Configuration of the Facebook Invite Friends Condensed PHP class is done through calls of the setter methods, which in turn set the private properties. There are couple of mandatory properties and couple of optional ones which are set by default. After the configuration is set, all you have to do is to call Render() method, and the control will display on page.
Setting mandatory properties
Setting optional properties




