Skip to content

Instantly share code, notes, and snippets.

@raynimmo
Created October 5, 2013 18:21
Show Gist options
  • Save raynimmo/974e2dbfc73e4e6b1a30 to your computer and use it in GitHub Desktop.
Save raynimmo/974e2dbfc73e4e6b1a30 to your computer and use it in GitHub Desktop.
redirect a user after login to a specific page
<?php
/**
* Implements hook_user_login().
*/
function mymodule_user_login(&$edit, $account) {
$current_path = drupal_get_path_alias($_GET['q']);
// If the user is logging in from the 'example' page, redirect to front.
if ($current_path == 'example') {
$_GET['destination'] = '<front>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment