You are here

function fb_permissions_get_facebook_permissions in Facebook Autopost 7

Helper function to get the selected facebook permissions.

Parameters

array $defaults: A keyed array of default permissions used to override the stored permissions.

int $role_id: Different roles may yield different permissions.

Return value

string An imploded string containing the permissions.

2 calls to fb_permissions_get_facebook_permissions()
FBAutopost::publish in class/FBAutopost.php
Publishes content in the selected pages
fb_autopost_global_settings in ./fb_autopost.admin.inc
FAPI system admin form.

File

fb_permissions/fb_permissions.module, line 171
Module implementation file.

Code

function fb_permissions_get_facebook_permissions($defaults = array(), $role_id = NULL) {
  $permissions = $defaults;
  if (empty($role)) {
    global $user;
    foreach ($user->roles as $role_id => $role) {
      $permissions = array_unique(array_merge(variable_get('fb_permissions_facebook_permissions:' . $role_id, array()), $permissions));
    }
  }
  else {
    $permissions = array_unique(array_merge(variable_get('fb_permissions_facebook_permissions:' . $role_id, array()), $permissions));
  }
  return implode(',', $permissions);
}