Hi, don't implement hook_menu() to override menu items of other modules. Implement hook_menu_alter() for that.

Use this function:

function nodeorder_menu_alter(&$items){

  $items['taxonomy/term/%taxonomy_term'] = array(
    'title' => 'Taxonomy term',
    'title callback' => 'taxonomy_term_title',
    'title arguments' => array(2),
    'page callback' => 'nodeorder_taxonomy_term_page',
    'page arguments' => array(2),
    'access arguments' => array('access content'),
    'file' => 'nodeorder.pages.inc',
    'module' => 'nodeorder',
  );

  return $items;

}
CommentFileSizeAuthor
#4 Override_menu_URL-1878144-4.patch2.4 KBintrafusion
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

valthebald’s picture

Version: 7.x-1.2 » 7.x-1.x-dev

Good point.
Can you please make a patch from this?

intrafusion’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Category: feature » bug
Priority: Normal » Major

The dev version is substantially different from the recommended release and this bug actually stops the module from working unless you alter the weight in the system table of the database.

The change is simple, just change nodeorder_menu to:

/**
 * Implements hook_menu().
 */
function nodeorder_menu() {
  $items = array();

  $items['admin/config/nodeorder'] = array(
    'title' => t('Nodeorder'),
    'description' => t('Allows the ordering of nodes within taxonomy terms.'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('nodeorder_admin'),
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
  );

  $items['taxonomy/term/%/order'] = array(
    'title' => t('Order nodes'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('nodeorder_admin_display_form', 2),
    'access callback' => 'nodeorder_order_access',
    'access arguments' => array(2),
    'file' => 'nodeorder.admin.inc',
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
  );

  return $items;
}

And add:

/**
 * Implements hook_menu_alter().
 */
function nodeorder_menu_alter(&$items) {
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'nodeorder_taxonomy_term_page';
  $items['taxonomy/term/%taxonomy_term']['file'] =  'nodeorder.pages.inc';
  $items['taxonomy/term/%taxonomy_term']['file path'] = drupal_get_path('module', 'nodeorder');
}
valthebald’s picture

Version: 7.x-1.2 » 7.x-1.x-dev

I'd love to see this as a patch. Please?

intrafusion’s picture

Priority: Major » Normal
FileSize
2.4 KB

My bad, I checked out the wrong version from Git.

Patch attached

  • dieuwe committed 418157f on 7.x-1.x authored by intrafusion
    Issue #1878144 by rolando.guedes, intrafusion: Override menu url.
    
dieuwe’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.