Last Updated: February 25, 2016
·
1.474K
· timonweb

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