Skip to content

Instantly share code, notes, and snippets.

@aaronott
Created August 6, 2012 20:40
Show Gist options
  • Save aaronott/3278232 to your computer and use it in GitHub Desktop.
Save aaronott/3278232 to your computer and use it in GitHub Desktop.
Make a user login prior to accessing anything on the site.
global $user;
/*
* If the user is not logged in, require them to login prior to being
* redirected to the form
*/
if ($user->uid === 0 && arg(0) != 'user') {
$dest = drupal_get_path_alias($_GET['q']);
drupal_goto('user', array('query' => array('destination' => $dest)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment