You are here

function invite_load in Invite 7.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_load()
  2. 5 invite.module \invite_load()
  3. 6.2 invite.module \invite_load()
  4. 7.4 invite.module \invite_load()

Load an invite record for a tracking code.

Parameters

$code: A registration code to load the invite record for.

Return value

An invite record.

6 calls to invite_load()
example_modify_invite in ./invite.api.php
Modify an invite.
example_send_invite_email in ./invite.api.php
Send an invitation email.
invite_find_invite in ./invite.module
Finds the invitation to assign to the new account when the user is registering.
invite_form_submit in ./invite.module
Forms API callback; process submitted form data.
invite_load_from_context in ./invite.module
Returns an invite object from an invite code stored in the user's session.

... See full list

File

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

Code

function invite_load($code) {
  $invites =& drupal_static(__FUNCTION__);
  if (!isset($invites)) {
    $invites = array();
  }
  if (!isset($invites[$code])) {
    $invite = db_select('invite', 'i')
      ->fields('i')
      ->condition('reg_code', $code)
      ->execute()
      ->fetchObject();
    if ($invite) {
      $invite->inviter = user_load($invite->uid);
      $invite->data = unserialize($invite->data);
      if ($invite->inviter->uid == 0) {
        $invite->inviter->name = t('Anonymous');
      }
      $invites[$code] = $invite;
    }
    else {
      return FALSE;
    }
  }
  return $invites[$code];
}