You are here

function simplenews_subscription_edit_access in Simplenews 6

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

Access callback for user newsletter editing.

1 string reference to 'simplenews_subscription_edit_access'
simplenews_user in ./simplenews.module
Implementation of hook_user().

File

./simplenews.module, line 830
Simplnews 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;
}