You are here

function user_external_invite_accept_invite in User External Invite 7

Same name and namespace in other branches
  1. 7.2 user_external_invite.module \user_external_invite_accept_invite()
  2. 1.0.x user_external_invite.module \user_external_invite_accept_invite()

Page callback for accepting an invite.

If logged in, checks invite token and grants role, sends to user page. If not logged in, sends to user/login with correct params to grant role on successful login.

1 string reference to 'user_external_invite_accept_invite'
user_external_invite_menu in ./user_external_invite.module
Implements hook_menu().

File

./user_external_invite.module, line 602
Invites a user to site when connecting via external protocol e.g. LDAP.

Code

function user_external_invite_accept_invite() {
  if (isset($_GET['key']) && isset($_GET['mail'])) {
    if (user_is_logged_in()) {
      global $user;
      user_external_invite_grant_invite($_GET['key'], $_GET['mail'], $user);
      drupal_goto('user');
    }
    else {
      drupal_goto('user/login', array(
        'query' => array(
          'key' => $_GET['key'],
          'mail' => $_GET['mail'],
        ),
      ));
    }
  }
}