Facebook Request Dialog is used to invite friends to start using an application, or to send requests for some specific action to application users. It is implemented in two forms: as a button or as a link, on which user has to click to open the request dialog. There is also an option to open it automatically on page load.

This class is a member of Facebook Connect PHP Toolkit. To see all classes from the toolkit, please look at the Facebook Connect Graph API classes.


Request Dialog Image

Following image represents the Facebook Request Dialog. Pictures of friends and last names are hidden, because of privacy protection.

facebook request dialog php


PHP Example

The example shows default Facebook Request Dialog, 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 Request Dialog PHP Example</title>
    </head>
    <body>
        <?php
            require_once 'facebook.php';
            require_once 'faceconn/faceconn.php';
            UseGraphAPI();

            $request = new RequestDialog();
            $request->SetMessage("Try Facebook Connect PHP Toolkit");
            $request->Render();
        ?>
        </body>
</html>



Facebook Request Dialog 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 Request Dialog Demo page.


Configuration

Configuration of the Facebook Request Dialog PHP class is done through calls of the setter methods, which in turn set the private properties. For Facebook Request Dialog 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.

facebook request dialog php
Method Name
Type
Description
facebook request dialog php
SetMessage
String
Function sets the message of the request dialog.
facebook request dialog php
SetTitle
String
Function sets the title of the request dialog.
facebook request dialog php
SetAdditionalData
String
Function sets the additional data of request dialog.
facebook request dialog php
SetFriendId
String
Function sets the friend ID. If it's set, the request will be sent just to this friend.
facebook request dialog php
SetCommandType
String
Function sets the type of the command control. Allowed values are 'link', 'button', 'image' and 'auto'. Default value is 'button'.
facebook request dialog php
SetCommandText
String
Function sets the title of a request button/link. Default value is 'Send Request'.
facebook request dialog php
SetCssStyle
String
Function sets the CSS style of the button/link.
facebook request dialog php
SetCssClass
String
Function sets the CSS class of the button/link.
facebook request dialog php
SetFilters
String
Function sets the filters of the request dialog.
facebook request dialog php
SetRedirectUri
String
Function sets the redirect URI of the request dialog.
facebook request dialog php
SetImage
String
Function sets the image of the button. Image type is set automatically.