Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add an admin/settings page for a Facebook Page (Tab) App, using the Graph API and PHP?
    text
    copied!<p>I have been searching through StackOverflow and Google search results to find this, but with no luck sifting through all the information.</p> <p>I have made an app for Facebook Pages, to be added as a tab. The app has a setting that needs to be set per Facebook Page it's added to - an ID to match which data and template to present in the app. However, I'm unable to get the information about the Page ID and whether the user is an admin for the page in my app.</p> <p>I'm using Facebook's PHP SDK, but even the examples there seem to be deprecated, since Facebook's move over to their Graph API. And I'm unable to find example code or documentation anywhere on how to request the info.</p> <p>This is my code (using the sdk 3.1.1):</p> <pre><code>require_once 'inc/facebook-php-sdk/src/facebook.php'; $fb_app_id = "............"; $fb_app_secret = "..................."; $facebook = new Facebook(array( 'appId' =&gt; $fb_app_id, 'secret' =&gt; $fb_app_secret, 'cookie' =&gt; true )); // Facebook magic sauce... $fb_signed_request = $facebook-&gt;getSignedRequest(); $fb_page_id = $fb_signed_request["page"]["id"]; $fb_like_status = $fb_signed_request["page"]["liked"]; $fb_is_admin = ($fb_signed_request["page"]["admin"]==1)?TRUE:FALSE; </code></pre> <p>When an admin (me) first visits the page, I get the 'admin' param set as 1, but when I click on any link in the app (iframe) the info is not passed on, so if I link to an admin page, it'll evaluate to false.</p> <p>All the info on the subject is for deprecated methods, and I can't even figure out the flow of how it would work with the Graph API. I would really appreciate some help or even just a point in the right direction...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload