You are here

function twitter_account_access in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.module \twitter_account_access()
  2. 7.6 twitter.module \twitter_account_access()

Access callback for the Twitter accounts page.

Parameters

object $account: The user account that 'owns' this Twitter accounts page.

Return value

Boolean TRUE if the current user has access.

1 string reference to 'twitter_account_access'
twitter_menu in ./twitter.module
Implements hook_menu().

File

./twitter.module, line 106
Provides API integration with the Twitter microblogging service.

Code

function twitter_account_access($account) {
  global $user;

  // First off, verify that the current user has one of the required
  // permissions and is viewing their own user account.
  if ($user->uid == $account->uid && (user_access('add twitter accounts') || user_access('add authenticated twitter accounts'))) {
    return TRUE;
  }

  // Otherwise, verify that they have the 'administer users' permission.
  if (user_access('administer users')) {
    return TRUE;
  }

  // If neither of the above permission checks are approved, they do not have
  // permission to access this page.
  return FALSE;
}