You are here

function invite_accept in Invite 7.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_accept()
  2. 6.2 invite.module \invite_accept()
  3. 7.4 includes/invite.pages.inc \invite_accept()

Menu callback; handle incoming requests for accepting an invite.

Parameters

$invite: A (unvalidated) invite object.

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

File

./invite.pages.inc, line 109
Page callbacks for invite module.

Code

function invite_accept($invite) {
  global $user;
  $status = invite_validate($invite);
  if (!$user->uid && $status == INVITE_VALID) {
    $_SESSION[INVITE_SESSION] = $invite->reg_code;
    drupal_goto(variable_get('invite_registration_path', 'user/register'));
  }
  else {
    switch ($status) {
      case INVITE_WITHDRAWN:
        drupal_set_message(t('This invitation has been withdrawn.'));
        break;
      case INVITE_USED:
        drupal_set_message(t('This invitation has already been used.'), 'error');
        break;
      case INVITE_EXPIRED:
        drupal_set_message(t('This invitation has expired.'));
        break;
    }
  }
  drupal_goto();
}