How To Redirect User To Any Page After Login in Drupal 7
Just put the following code into your custom module:
/**
* Implements hook_user_login().
*/
function module_name_user_login(&$edit, $account) {
// Don't redirect on password reset.
$current_menu_item = menu_get_item();
if ($current_menu_item['path'] == 'user/reset/%/%/%') {
return;
}
// Redirect user to profile page after the login.
$_GET['destination'] = 'user';
}
You can find this snippet at dropbucket.org here: http://dropbucket.org/node/746
Written by Tim Kamanin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Drupal
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#