You are here

function fb_permission_fb_required_perms_alter in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 contrib/fb_permission.module \fb_permission_fb_required_perms_alter()

Implements hook_fb_required_perms_alter().

fb_connect.module can calls this to learn when perms to add to login-button.

File

contrib/fb_permission.module, line 123
Code pertaining to Facebook's extended permissions. see http://wiki.developers.facebook.com/index.php/Extended_permissions

Code

function fb_permission_fb_required_perms_alter(&$perms) {
  global $_fb, $_fb_app;
  $fb_app_data = fb_get_app_data($_fb_app);
  if (isset($fb_app_data['fb_permission'])) {
    $fb_permission_data = $fb_app_data['fb_permission'];
    foreach ($fb_permission_data['prompt'] as $key => $value) {
      if ($value) {
        $perms[$key] = $key;
      }
    }
  }
  if (!empty($GLOBALS['_fb_permission_extra_perms'])) {

    // Some page require additional perms, and it makes sense to include those on all connect buttons and links.
    foreach ($GLOBALS['_fb_permission_extra_perms'] as $key) {
      $perms[$key] = $key;
    }
  }
}