You are here

function userpoints_access_transactions in User Points 7.2

Checks if a user has access to own or other users transactions history.

The user must be logged in to have access both, own or other users transactions.

Parameters

$account: (optional) The account to check; if not given use currently logged in user.

Return value

TRUE if the user has access to view the transactions of the requested account and FALSE otherwise.

1 call to userpoints_access_transactions()
userpoints_get_points_list in ./userpoints.module
Returns a render array that displays the points and action links.
1 string reference to 'userpoints_access_transactions'
userpoints_menu in ./userpoints.module
Implements hook_menu().

File

./userpoints.module, line 389

Code

function userpoints_access_transactions($account = NULL) {
  global $user;

  // Other users accounts.
  if ($account && $user->uid != $account->uid) {
    return (user_access('view userpoints transactions') || userpoints_admin_access('edit')) && user_is_logged_in();
  }

  // Own user account.
  $user_has_transactions_permissions = user_access('view own userpoints transactions') || user_access('view userpoints transactions') ? TRUE : FALSE;
  return ($user_has_transactions_permissions || userpoints_admin_access('edit')) && user_is_logged_in();
}