Duplicate menu item in CMS after extending SecurityAdmin

Silverstripe Version:
4.2.1

Question:

I have an extension to class SilverStripe\Admin\SecurityAdmin. The extension itself works fine, but it has created a duplicate menu item in the CMS. Inspection in the browser shows one item with id=“Menu-SilverStripe-Admin-SecurityAdmin” and the other with id=“Menu-App-Web-SecurityAdminExtension”. Clicking on either takes you to SecurityAdmin.

Any ideas how to hide the duplicate item?

52%20AM

I’m using the silverstripe-grouped-cms-menu module, but I’m not convinced it is causing the problem.

Does the issue go away if you uninstall / deactivate the grouped menu module? If you can establish this, it would at least help you track down the root cause.

@Tim turns out I’m subclassing SecurityAdmin (couldn’t get desired functionality to work as an extension). Commenting out the sub class removes the duplication (but also of course the added functionality). Is there a way to prevent items automatically being added to CMS Menu? Or to override the default name?

The subclass is intended to extend SecurityAdmin so that custom messages can be sent out to selected members as per Sending email to a subset of members (my preference would be to use an extension instead, but wasn’t able to get it to work - I have many other extensions working on my site, so maybe SecurityAdmin can’t be extended or I’m missing something???)

1 Like

Did you ever get a SecurityAdmin extension to work? I’m having a similar problem.

It can be extended, of course. You’ll need to remove one of the items from the left menu. It can be done via yaml config or inside your config.php — you’ll need to do a bit of digging, but it’s possible.

It can be extended, of course

Are you sure?