You are here

function invite_load_from_session in Invite 7.4

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

Loads Invite using information stored in session.

Return value

bool|Invite Return invite or FALSE.

5 calls to invite_load_from_session()
invite_by_email_form_user_register_form_alter in modules/invite_by_email/invite_by_email.module
Implements hook_form_FORMID_alter().
invite_user_insert in ./invite.module
Implements hook_user_insert().
invite_user_login in ./invite.module
Implements hook_user_login().
invite_user_presave in ./invite.module
Implements hook_user_presave().
invite_user_register_access in ./invite.module
Access callback; determine access to user registration form.

File

./invite.module, line 560

Code

function invite_load_from_session() {
  if (isset($_SESSION[INVITE_SESSION_CODE])) {
    $invite = invite_by_code_load($_SESSION[INVITE_SESSION_CODE]);
  }
  elseif (arg(0) == 'user' && arg(1) == 'register' && ($reg_code = arg(2))) {
    if ($invite = invite_by_code_load($reg_code)) {
      $_SESSION[INVITE_SESSION_CODE] = $invite->reg_code;
    }
  }
  if (!empty($invite)) {
    return $invite;
  }
  else {
    return FALSE;
  }
}