Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Remove Menu Item from Admin


Go to End
Reply


20 Posts   7133 Views

Avatar
DoofusDog

Community Member, 9 Posts

16 May 2009 at 8:14am

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

Avatar
Willr

Forum Moderator, 5513 Posts

16 May 2009 at 10:44am

I think the correct method now for 2.3 is using

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

Avatar
DoofusDog

Community Member, 9 Posts

16 May 2009 at 10:47am

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.

Avatar
DoofusDog

Community Member, 9 Posts

16 May 2009 at 10:53am

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");

?>

Avatar
Willr

Forum Moderator, 5513 Posts

16 May 2009 at 11:06am

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.

Avatar
DoofusDog

Community Member, 9 Posts

16 May 2009 at 11:10am

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

Avatar
Phill

Community Member, 75 Posts

22 May 2009 at 4:49am

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'
);

Avatar
BLU42 Media

Community Member, 71 Posts

27 June 2009 at 6:41am

Edited: 27/06/2009 7:06am

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');
   }
}

Go to Top