Checking Page Properties
Problem
I need to find out if a user is the admin of a Page, or if a Page has my app installed, or whether a user is a fan of a specific Page.
Solution
Use the Pages.isAdmin()
method to find out whether the current loggedinuser
is an admin of a specific
Page:
$result = $facebook->api_client->pages_isAdmin('123456789');
where 123456789 is the pageid
of the Page you’re interested in.
Use the Pages.isFan()
method to find out whether a user is a fan of a specific Page:
$result = $facebook->api_client->pages_isFan('123456789', '12345');
where 123456789 is the pageid
of the Page you’re interested in, and 12345 is the optional uid
of the user you want to check for (it
defaults to the current loggedinuser
if you leave it off).
Use the Pages.hasAppAdded()
method to find out if a specific Page has your app
added:
$result = $facebook->api_client->pages_hasAppAdded('123456789');
where 123456789 is the pageid
of the Page you’re interested in.
Discussion
All three methods return true (1
) if the thing you’re checking is true, or
false (0
) if it isn’t (or the
pageid
can’t be found).
Get Facebook Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.