You are here

function require_login_init in Require Login 6

Same name and namespace in other branches
  1. 7 require_login.module \require_login_init()

Implementation of hook_init().

File

./require_login.module, line 7

Code

function require_login_init() {
  global $user, $base_path;
  if (!isset($_SESSION['openid']['service']['uri']) && !isset($_SESSION['openid']['claimed_id'])) {
    if (request_uri() != $base_path . 'cron.php' && !$user->uid && !(arg(0) == 'user' && (!arg(1) || arg(1) == 'password' || arg(1) == 'reset' || arg(1) == 'register'))) {
      drupal_set_message(t('You must login to use this site.'));
      drupal_goto('user', 'destination=' . rawurlencode($_GET['q']));
    }
  }
}