How can I add a section in the Admin Menu?

Solved NodeBB Development
  • Hey guys, looked at the documentation briefly and didn't see any ways to add a section
    to the Administration Menu.

    Something like this:

  • GNU/Linux

    To do this you want to:

    First, add

    <!-- IF custom_menu.length -->
      <div class="sidebar-nav">
        <ul class="nav nav-list">
          <li class="nav-header"><i class="fa fa-fw fa-th"></i>Your List Category</li>
          <!-- BEGIN custom_menu -->
            <a href="{relative_path}/admin{custom_menu.route}">
            <!-- IF custom_menu.icon -->
            <i class="fa {custom_menu.icon}"></i>
            <!-- ENDIF custom_menu.icon -->
        <!-- END custom_menu -->
    <!-- ENDIF custom_menu.length -->

    to /src/views/admin/partials/menu.tpl.

    Then, add

    custom_menu: results.custom_header.custom_menu,


    var data = {
      relative_path: nconf.get('relative_path'),
      configJSON: JSON.stringify(results.config),
      user: userData,
      userJSON: JSON.stringify(userData).replace(/'/g, "\\'"),
      plugins: results.custom_header.plugins,
      authentication: results.custom_header.authentication,
      scripts: results.scripts,
      'cache-buster': meta.config['cache-buster'] ? 'v=' + meta.config['cache-buster'] : '',
      env: process.env.NODE_ENV ? true : false,

    (around line 100) in /src/middleware/admin.js.

    As for the plugin: I've created a quick and dirty example you can have a look at over at GitHub.

    In a nutshell, the same aproach as you would add a normal "Installed Plugins" entry, with the exception that you define your own array that is passed to the template, hence the need to change two core files. 🙂

  • Plugin & Theme Dev

    I know this is an old topic, but I just ran into this today and wanted to add an admin nav section in the minimally invasive way possible. This technique worked for me and I'm wondering if anybody has any thoughts about this being a good or bad approach to quickly adding a custom admin navigation menu from a plugin. Any critiques appreciated!


    var adminInitialized = false;
    $(window).on('action:ajaxify.start', function(data) {
    	if (!adminInitialized) {
    		<li class="dropdown menu-item">\
    			<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Custom Menu</a>\
    			<ul class="dropdown-menu" role="menu">\
    				<li><a href="/admin/my-custom-route">Custom Route</a></li>\
    		adminInitialized = true;


    "acpScripts": [
  • This post is deleted!

Suggested Topics

| | | |