You are here

function invite_user_register_access in Invite 6.2

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

Access callback; determine access to user registration form.

2 string references to 'invite_user_register_access'
invite_form_alter in ./invite.module
Implementation of hook_form_alter().
invite_menu_alter in ./invite.module
Implementation of hook_menu_alter().

File

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

Code

function invite_user_register_access() {
  $invite = invite_load_from_session();

  // Legacy url support (user/register/regcode).
  if (!$invite && ($code = arg(2))) {
    if ($invite = invite_load($code)) {
      if (invite_validate($invite)) {
        $_SESSION[INVITE_SESSION] = $invite->reg_code;
      }
    }
  }
  if (!$invite && !user_access('administer users')) {

    // The menu system checks access whenever local tasks are displayed. Make
    // sure the message is output only for the path user/register.
    if (arg(1) == 'register') {
      drupal_set_message(t('Sorry, new user registration by invitation only.'));
    }
    return FALSE;
  }

  // Let the default handler take care of standard conditions.
  return user_register_access();
}