Replacement for FBML fb:visible-to-connection

672 views Asked by At

FBML has been deprecated. What's the simplest replacement for fb:visible-to-connection, which is used to show part a page only to fans?

1

There are 1 answers

1
Niraj Shah On BEST ANSWER

This is pretty easy to do in PHP (using the Facebook SDK). If you decode the signed_request data POSTed to your page, you can see if the user has liked the Page your app is on.

If you decode the data (e.g. in PHP you can do: print_r( $facebook->getSignedRequest() ); to print the decoded version), you will see something like:

Array
(
    ...
    [page] => Array
        (
            [id] => 1234567890
            [liked] => 1
            [admin] => 1
        )
    [user] => Array
        (
            ...
        )
)

The $response['page']['liked'] will be 1 if the user has liked the page, and 0 otherwise. You can then wrap your Fan Specific content around a conditional statement:

if ( $response['page']['liked'] === 1 ) {
    // user if fan
} else {
    // not a fan
}