How to add /users on Top Menu?

/users page works properly as a leaderboard. I was willing to add it on top menu.

Is there a easy way to do it? Maybe without code :stuck_out_tongue:

Try this in Customize - Theme - </head>

<script>
  Discourse.ExternalNavItem = Discourse.NavItem.extend({
    href : function() {
      return this.get('href');
    }.property('href')
  });

  I18n.translations.en.js.filters.users = { title: "Users", help: "User leaderboard" };

  Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
      var list = this._super(category, args);
      list.push(Discourse.ExternalNavItem.create({href: '/users', name: 'users'}));
      return list;
    }
  });
</script>

This is sort of there, the big challenge is keeping that nav around when you hit directory, far trickier problem.

1 Like

Would it be a big deal to extend the functionality of the top menu site setting so that it can handle any url path (based on the site url) in a similar fashion as it now handles category/<category_name>?

This is now doable in a theme component.

See: Add /users to top nav

At the moment, yes, it would be a very complex change.

6 Likes

Your script is very very useful, in that we can see, in one screenful, the list of all the likes received, given, topics read/written, replies given/viewed, visits to the site. And also all the users are shown very neatly on the map (maps location plugin is installed on my instance). But sorry to find that this whole useful information also becomes available to all users, which is undesired.

Alternatively, if we delete this script and go to Admin> Settings> Users, then much info, likes given/received, visits made etc are not shown.
So, is there a way to disable this view to normal users?

2, As an experiment, I deleted this script, because of this undesired trait, I found that I can still go to that URL, which was there when script was working (link), and found the user map.
image

Now the question/curiosity is that, while on this page, if I click on ‘Users List’, the button works fine and shows the list of users and their activity as desired (in the URL bar, url now shows as: बठिंडा हेल्पर ).
But if I refresh this page or later on manually type this url and go to /u page, then nothing is shown and a blank page keeps showing.

What makes it do so?