how to hide comments in elgg_view_menu

i have this code:

elgg_view_menu('entity', array(

'entity' => $vars['entity'],

'handler' => 'handlername',

'sort_by' => 'priority',

'class' => 'elgg-menu-hz',


This shows:
Edit, Comment, Like. And more

how to hide comment ? 


  • 1. Remove in  Entity Menu

    • Open file: \engine\lib\navigation.php
    • Navigate to function elgg_entity_menu_setup($hook, $type, $return, $params): remove what you want

    2. Remove Comment

    Follow this link

  • This is wrong and its the bad way of elgg coding. If you modify core files, unless you dont have documentation on the changes, you wont be able to upgrade or preserve your changes while you upgrade elgg. The proper way of doing it is creating a plugin hook for the menu:entity setup and unregistering the particular menu.

    if you dont know how to do that, simply use css /jquery to set the display as none for that particular menu element.

  • Writing jquery function does sounds easy solution, but doesn't it opens the website for unauthorised access as the element will still be present and can be enabled easily by a simple tool like firebug?
    I am also facing similar issue where I want to hide certain items from the screen for a while. I am a newbie so still not good with concepts and working of hooks but will like to know more about that approch.

  • @All my meaning is not the comment my meaning is the comment button option when we use elgg-menu-hz it display a menu how to remove comment option from that menu?

  • Webgalli is absolutely right. DO NOT EDIT CORE. The correct solution is to use the hook and remove the menu item. There are also some menu helper plugins that might let you do this, but I haven't tried any.

    For the record, offers some pretty awful advice, not to mention they are in willful violation of our domain policy. Following their instructions is a great way to either break your site or make it a pain to upgrade.