How to change the menu system path in Drupal

Hello folks

Today I had the task to change the response page for the Drupal system menu/path: user/login to a custom page, since this is not a visual menu, you can't use the Drupal Menu system to change or redirect URL .

So you must solve this request using code, below two examples how you can solve it:

Replace the response function:

function YOURMODULE_menu_alter(&$items) {
  $items['user/login']['page callback'] = 'drupal_get_form';
  $items['user/login']['page arguments'] = array('user_register');
  $items['user/login']['type'] = MENU_LOCAL_TASK;
}


Redirect the response page:

function YOURMODULE_menu_alter(&$items) {

    $items['user/login']['page callback'] = "drupal_goto";
    $items['user/login']['page arguments'] = array('user/register');
    $items['user/login']['type'] = MENU_LOCAL_TASK;
}

Enjoy IT

enzo