I created my site's homepage using panels(disable blocks regions)and there i placed the user login block. When a user is logged in through the block he is redirected to the homepage while if the user use user/login page he is redirected to his profile. Can i make the login through the block redirect also to the user profile?

4 Answers 4


Take a look at the Login Destination and the LoginToboggan modules. They should do what you want.
The first module allows you to customize the destination to which a user is redirected after logging in, registering to the site (7.x), using a one-time login link or logging out (7.x). The destination can be an internal page or an external URL. It is possible to specify certain conditions like referring pages, or user roles, and make the destination depend upon them. You may use PHP snippets to provide custom conditions and destinations. It is also possible to keep users on the currently visited page after logging in or out.

  • Thanks for your answer. I installed login destination module and set the redirection path to user/ but still when i login from the user login block it redirects me to the homepage. After some more search i found drupal.org/node/298506 which did the task.
    – Pavlos
    Aug 9, 2011 at 12:58

Rules is probably a better method in this scenario IMHO; however here's another way for the record.

 * Implements hook_form_FORM_ID_alter().

function mycustommodule_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $path = current_path();

    // Add recruiter specific fields.
    if ( $path == 'user/login') {

      $form['#submit'][] = 'mycustommodule_new_register_submit';


function mycustommodule_new_register_submit($form, &$form_state) {

$form_state['redirect'] = 'user'; 


You can use Rules module. It gives you ability to add rule for particular condition. You can write your rule to redirect after successful login.


I have the same proplem, And its solved with me by change #action like this:

  if($form_id == 'user_login_block'){
      global $base_path, $language;
      $lang = $language->language;
      $form['#action'] = $base_path."$lang?destination=user";
      $form_state['rebuild']  = TRUE;

I hope this help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.