HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

3.0.2 Adding menu item to Moderation sidemenu

I'm making an infraction plugin for moderators to use on my site, but I can't seem to get a link to show up on the Moderation tab.

Been trying with this code (and changing 'Moderation' to 'Forum' in addLink) but it only ever shows up on the Settings tab.

  public function base_getAppSettingsMenuItems_handler($Sender) {

    $Menu = $Sender->EventArguments['SideMenu'];

    $Menu->addLink('Moderation', t('Infraction'), 'plugin/infraction', 'Garden.Moderation.Manage');

  }

Comments

  • R_JR_J Admin

    Try it that way:


       public function dashboardNavModule_init_handler($sender) {
           // Create a group under the Moderation group.
           $sender->addGroupToSection(
               'Moderation',
               t('Infraction'),
               'infraction',
               'Infraction',
               ['after' => 'site']
           );
           // Add links to it
           $sender->addLinkToSectionIf(
               'Garden.Community.Manage',
               'Moderation',
               Gdn::translate('Sunshine'),
               '/plugin/Sunshineon/sunshine',
               'infraction.sunshine'
           );
       }
    


  • R_JR_J Admin

    Look at the methods of the SiteNavModule to understand what the parameters in the snippet above are used for

  • Awesome, thanks for pointing me in the right direction.

Sign In or Register to comment.