You are here

function invite_validate in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_validate()
  2. 7.4 invite.module \invite_validate()
  3. 7.2 invite.module \invite_validate()

Validates an invite record.

Parameters

$invite: An invite record as returned by invite_load().

Return value

TRUE if the invite is valid, otherwise this function won't return.

3 calls to invite_validate()
invite_accept in ./invite.module
Menu callback; handle incoming requests for accepting an invite.
invite_form_alter in ./invite.module
Implementation of hook_form_alter().
invite_user_register_access in ./invite.module
Access callback; determine access to user registration form.

File

./invite.module, line 439
Allows your users to send and track invitations to join your site.

Code

function invite_validate($invite) {
  if (!$invite || !$invite->inviter) {
    drupal_set_message(t('This invitation has been withdrawn.'));
    drupal_goto();
  }
  elseif ($invite->joined != 0) {
    drupal_set_message(t('This invitation has already been used. Please login now with your username and password.'));
    drupal_goto('user');
  }
  elseif ($invite->expiry < time()) {
    drupal_set_message(t('Sorry, this invitation has expired.'));
    drupal_goto();
  }
  else {
    return TRUE;
  }
}