Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

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 Cheerleader & Troubleshooter Munich Moderator

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



    TheCanuck37
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    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.