You are here

function _subscriptions_access in Subscriptions 7

Same name and namespace in other branches
  1. 6 subscriptions.module \_subscriptions_access()
  2. 2.0.x subscriptions.module.old.php \_subscriptions_access()

Parameters

object|null $account:

string|null $access:

Return value

bool

1 string reference to '_subscriptions_access'
subscriptions_menu in ./subscriptions.module
Implements hook_menu().

File

./subscriptions.module, line 231
Subscriptions module.

Code

function _subscriptions_access($account, $access = NULL) {
  global $user;
  if ($account && $account->uid) {
    if (isset($access)) {
      $has_access = user_access($access, $account);
    }
    else {
      foreach (subscriptions_types() as $stype => $data) {
        if (user_access($data['access'], $account)) {
          $has_access = TRUE;
        }
      }
    }
    return !empty($has_access) && ($account->uid == $user->uid || user_access('administer user subscriptions'));
  }
  return FALSE;
}