How to redirect user to the custom page programatically after login

As there is no normal answer for this problem on Drupal.org forums i will show the way it works for Drupal 6:
1. Create new module or edit some custom module you created (do not edit core modules, it is really unprofessional)
2. Use this code snippet below:

function yourmodule_user($op, &$edit, &$account, $category = NULL) {
  // hook_user: http://api.drupal.org/api/function/hook_user/6
  switch ($op) {
    case 'login':
      $_REQUEST['destination'] = 'your/super/page'; // change your/super/page to your custom destination
    break;
  }
}

3. Don't forget to check if your Drupal installation uses Trigger: "after user login" to fire some actions. Because if Trigger module will run before your custom module, hook_user with $op='login' will not run. Details here

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.