1

I have drupal 6.x and I have installed the module "Admin menu". I want to know how can I remove some content types of the menu? I have looked that this menu loads all options of the website and I only require to remove the some content types of the menu.

Thanks for your help.

1

I do not know if this way is useful for you: In admin_menu.module I have included a php if in admin_menu_tree_output to detect and remove items according links of content types to hide:

for example, I have several content types with the address http://yourdomain.com/admin/content/node-type/testcontenttypeXX. (XX is numbers)

then I have added if(preg_match('/(testcontenttype)/',$serializeData) == false) to admin_menu_tree_output function, seeking in $serializeData = serialize($data['link']); the respective address:

function admin_menu_tree_output($tree) {
  $output = '';

  foreach ($tree as $data) {
    $extra_class = isset($data['link']['localized_options']['extra class']) ? $data['link']['localized_options']['extra class'] : NULL;
    $link = admin_menu_item_link($data['link']);
    $serializeData = serialize($data['link']);

    if ($data['below']) {   
            if(preg_match('/(testcontenttype)/',$serializeData) == false){
                $output .= theme_admin_menu_item($link, $data['link']['has_children'], admin_menu_tree_output($data['below']), $data['link']['in_active_trail'], $extra_class);
            }
        }
    else {
        if(preg_match('/(testcontenttype)/',$serializeData) == false){
            $output .= theme_admin_menu_item($link, $data['link']['has_children'], '', $data['link']['in_active_trail'], $extra_class);
        }
    }
  }
  return $output ? "\n<ul>". $output .'</ul>' : '';
} 

I hope information be useful.

3

While you can add/remove items from the admin menu from this menu /admin/build/menu-customize/admin you really shouldn't, that would be customizing what that module does and anytime they release a new version you would have to make your customization again.

The purpose of that module to to simplify, or make shortcuts to, all of the aspects of administering a Drupal site. If there are certain portions of the admin you don't want users to see, use roles to control which of the links are viewable.

Hope this helps!

  • Thanks for your answer. Your solution is good for my question, but this solutions doesn't allow remove some content types of the "Admin menu" because in the menu the content types are not listed. I am going to update my question. Thanks again. – cabita Oct 22 '11 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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