You are here

function _invite_validate in Invite 5

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.

2 calls to _invite_validate()
invite_action in ./invite.module
Menu callback; handle incoming requests for accepting an invite.
invite_form_alter in ./invite.module
Implementation of hook_form_alter().

File

./invite.module, line 1232
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();
  }
  else {
    if ($invite->timestamp != 0) {
      drupal_set_message(t('This invitation has already been used. Please login now with your username and password.'));
      drupal_goto('user');
    }
    else {
      if ($invite->expiry < time()) {
        drupal_set_message(t('Sorry, this invitation has expired.'));
        drupal_goto();
      }
      else {
        return TRUE;
      }
    }
  }
}