You are here

function simplenews_subscription_edit_access in Simplenews 7

Same name and namespace in other branches
  1. 6.2 simplenews.module \simplenews_subscription_edit_access()
  2. 6 simplenews.module \simplenews_subscription_edit_access()
  3. 7.2 simplenews.module \simplenews_subscription_edit_access()

Access callback for user newsletter editing.

1 string reference to 'simplenews_subscription_edit_access'
simplenews_user_categories in ./simplenews.module
Implements hook_user_categories().

File

./simplenews.module, line 1004
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_subscription_edit_access($account) {
  global $user;

  // Disallow anonymous.
  if (!$account || $account->uid == 0) {
    return FALSE;
  }

  // Allow edit own subscription.
  if ($user->uid == $account->uid) {
    if (user_access('subscribe to newsletters', $account)) {
      return TRUE;
    }
  }

  // Allow administrator to edit account's subscription.
  if (user_access('administer users')) {
    return TRUE;
  }
  return FALSE;
}