marcgg
marcgg

Reputation: 66455

How to get if a user is admin of a page (isAdmin) using the Facebook Graph API?

Using the old REST API, you could do call https://api.facebook.com/method/pages.isAdmin to know if a user was the admin of a given page.

How can you do that using the Graph API? I can't find anything about it in the documentation and start to wonder if it's even possible.

Upvotes: 4

Views: 8568

Answers (5)

Mike Lapinskas
Mike Lapinskas

Reputation: 159

From FB docs: GET /v2.2/{page-id}/roles/{user-id}

Also see How can i get the admins user id of a page in facebook.?.

Upvotes: 0

Julio Popócatl
Julio Popócatl

Reputation: 782

You can try this:

$page=$facebook->api('/[PAGE ID]?fields=access_token');
if (!$page['access_token'])
    echo "is not admin";

Upvotes: 0

creativeshampoo
creativeshampoo

Reputation: 11

$session_key = $_REQUEST['fb_sig_session_key'];//maybe there is a better way to get this
$access_token = $facebook->getAccessToken();
$is_admin = $facebook->api(array('method'=>'pages.isadmin', 'page_id'=>'YOUR_PAGE_ID', 'session_key'=>$session_key, 'access_token'=>$access_token));

Upvotes: 1

serg
serg

Reputation: 111325

Another option would be to run FQL on page_admin table.

Upvotes: 0

Peter Bailey
Peter Bailey

Reputation: 105908

You may be able to view that info in the accounts connection

Upvotes: 3

Related Questions