Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » Remove Menu Item from Admin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 6615 Views
  • DoofusDog
    Avatar
    Community Member
    9 Posts

    Remove Menu Item from Admin Link to this post

    I am trying to remove the "help" button from the admin by using:

    Object::addStaticVars('LeftAndMain', array(
    'removed_menu_items' => array(
          'help',
       )
    ));

    in mysite/_config.php file but it does not have any effect of error. I am sure I am missing something.

    I am using SS v2.3.1

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Remove Menu Item from Admin Link to this post

    I think the correct method now for 2.3 is using

    CMSMenu::remove_menu_item('help'); // or try 'Help'

  • DoofusDog
    Avatar
    Community Member
    9 Posts

    Re: Remove Menu Item from Admin Link to this post

    I tried both of those versions and got the same result. No error and the help button is still there. I did run the flush between tests as well.

  • DoofusDog
    Avatar
    Community Member
    9 Posts

    Re: Remove Menu Item from Admin Link to this post

    For reference here is my mysite/_config.php file

    <?php

    global $project;
    $project = 'mysite';

    global $databaseConfig;
    $databaseConfig = array(
       "type" => "MySQLDatabase",
       "server" => "localhost",
       "username" => "root",
       "password" => "******",
       "database" => "******",
    );

    // Remove the 'Help' button in the CMS
    CMSMenu::remove_menu_item('Help');

    // Sites running on the following servers will be
    // run in development mode. See
    // http://doc.silverstripe.com/doku.php?id=devmode
    // for a description of what dev mode does.
    Director::set_dev_servers(array(
       'localhost',
       '127.0.0.1',
    ));

    // This line set's the current theme. More themes can be
    // downloaded from http://www.silverstripe.com/themes/
    SSViewer::set_theme('default');

    // The next three lines customizes the admin graphics
    LeftAndMain::setApplicationName("Website CMS");
    LeftAndMain::setLogo(".../themes/cms/logo.gif", "position: relative; left: 5px; margin-top: -3px; padding-left: 50px;");
    LeftAndMain::set_loading_image("../themes/cms/loading.gif");

    ?>

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Remove Menu Item from Admin Link to this post

    Ok this is a bug - I just noticed it on my localhost as well. It looks like the help link is added right at the end of the operations. This should be a ticket in open.silverstripe.com.

  • DoofusDog
    Avatar
    Community Member
    9 Posts

    Re: Remove Menu Item from Admin Link to this post

    Sorry for nubbie-ness. IS that something I need to do?

  • Phill
    Avatar
    Community Member
    75 Posts

    Re: Remove Menu Item from Admin Link to this post

    I was having this trouble aswell with the latest stable build found the temp fix for now in /cms/code/LeftAndMain.php just comment out lines 111-115 which stops the help link being added to the menu

    CMSMenu::add_link(
       'Help',
       _t('LeftAndMain.HELP', 'Help', PR_HIGH, 'Menu title'),
       'http://userhelp.silverstripe.com'
    );

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Remove Menu Item from Admin Link to this post

    A nice, clean way to remove the Help Menu is to decorate LeftAndMain so you don't have to mod your core files:

    In your _config.php file, add:

    Object::add_extension('LeftAndMain', 'MyLeftAndMainDecorator');

    In your /code folder, create MyLeftAndMainDecorator.php and enter the following:

    <?php

    class MyLeftAndMainDecorator extends LeftAndMainDecorator {

       function init() {
          CMSMenu::remove_menu_item('Help');
       }
    }

    6615 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.