Custom profile stats filter

NodeBB Development
  • I wonder if there is a filter to add custom field stats on a user profile.
    ex: followers, following, my custom counter, my custom counter

    Screenshot from 2019-10-15 12-58-22.png

    at moment, i call this filter to add my counters


    But in this way i have to add custom css code on the client side. There is a way to add them graphically on the server side?

    For example when i call this filter


    is not neccessary to add client css code because this function do anything

    plugin.getProfileMenu = function(data, callback) {
        title: '[[pages:user/myprop]]',
        id: 'mybutton',
        route: 'mybutton',
        name: 'mybutton',
        visibility: {
          self: true,
          other: true,
          moderator: true,
          globalMod: true,
          admin: true,
      callback(null, data);
  • If you want them there, then you probably have to modify the template to add the items, since they are not dynamically generated from a list like the items in the user profile menu.

    <div class="stat">
    	<div class="human-readable-number"  title="{followingCount}">{followingCount}</div>
    	<span class="stat-label">[[user:following]]</span>

    Just copy this block and add them below, and the styling should be preserved.

  • @julian
    Thanks. Yes it works fine. Only one problem.

    Seems like


    is not called when i refresh the page. It is called only if browse the forum. I noticed it now because i use this hook to capture user counters and put them into the stats page.
    It wont work also with simple code, outside or inside the document-ready function.

    P.S: i just solved using directly

    global variable. It is just a problem of the hook

Suggested Topics