Custom profile stats filter



  • 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

    filter:user.account
    

    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

    filter:user.profileMenu
    

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

    plugin.getProfileMenu = function(data, callback) {
      data.links.push({
        title: '[[pages:user/myprop]]',
        id: 'mybutton',
        route: 'mybutton',
        name: 'mybutton',
        visibility: {
          self: true,
          other: true,
          moderator: true,
          globalMod: true,
          admin: true,
        },
      });
    
      callback(null, data);
    }
    

  • GNU/Linux Admin

    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>
    </div>
    

    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

    'action:ajaxify.dataLoaded'
    

    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

    ajaxify.data
    

    global variable. It is just a problem of the hook


Log in to reply
 

Suggested Topics

| |