1
votes

In Drupal 7 module development, supposedly by using the hook_menu function, how can I add menu link to the user menu? Here.

I found easily it in the administration but I can't find how to do it programmatically, I haven't found any menu type that would fit this situation. Thanks.

1

1 Answers

1
votes

You could specify the menu_name in the data returned by your hook_menu():

function MYMODULE_menu() {
  $items['example'] = array(
    'title' => 'Example Page',
    'page callback' => 'example_page',
    'menu_name' => 'user-menu', // << Menu name
    'weight' => 12, // << position
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

By default, it is added in the Navigation menu.

enter image description here