You are here

function invite_withdraw_access in Invite 7.4

Same name and namespace in other branches
  1. 7.2 invite.module \invite_withdraw_access()

Access callback for withdraw confirmation form.

Parameters

Invite $invite: The invitations to be withdrawn.

Return value

bool Is user have access or no.

1 string reference to 'invite_withdraw_access'
invite_menu in ./invite.module
Implements hook_menu().

File

./invite.module, line 413

Code

function invite_withdraw_access($invite) {
  global $user;
  if ($invite->status == INVITE_WITHDRAWN) {
    drupal_set_message(t('The invitation has already been withdrawn.'), 'error');
    return FALSE;
  }
  if (!$invite->joined) {
    $permission = 'withdraw own invitations';
  }
  else {
    $permission = 'withdraw own accepted invitations';
  }
  if (($invite->uid == $user->uid || $invite->invitee == $user->uid) && user_access($permission) || user_access('administer invitations')) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}