You are here

function instagram_feeds_access in Instagram Feeds 7

Menu access callback.

Parameters

string $action: The action to be performed. Possible values are:

  • import

mixed $param: Node object or FeedsImporter id.

Return value

bool TRUE If user have access to import Instagram images, FALSE otherwise.

1 string reference to 'instagram_feeds_access'
instagram_feeds_menu in ./instagram_feeds.module
Implements hook_menu().

File

./instagram_feeds.module, line 1097

Code

function instagram_feeds_access($action, $param) {
  if (!in_array($action, array(
    'import',
  ))) {

    // If $action is not one of the supported actions, we return access denied.
    return FALSE;
  }
  $importer_id = NULL;
  if (is_string($param)) {
    $importer_id = $param;
  }
  elseif ($param->type && INSTAGRAM_FEEDS_SETTINGS_NODE_TYPE == $param->type) {
    $importer_id = $param->nid;
  }

  // Check for permissions if feed id is present, otherwise return FALSE.
  if ($importer_id) {
    if (user_access('administer feeds')) {
      return TRUE;
    }
  }
  return FALSE;
}