Make /admin/users/list sortable? (suggestion)


Seen, Topics Viewed, Posts Read, and Read Time

I think this would be helpful in seeing who is potential mod material (and which mods are not as active as you would expect a moderator to be).


This is already possible on /users so I’m not quite sure why it would need to be duplicated in admin?


Maybe it is confusing to see it working on one list but not on another?

("…I am sure that it worked yesterday, but it seems it stopped working…")


Mainly to see which staff members are most/least active.

1 Like

You can do that in public through a group, see Discourse Meta

It’s missing the some important info though (I would also add number of replies).

A forums and mod teams grow I think having something like this would be handy. Or perhaps add some sort of ‘mod criteria’ system (so for example, if a mod has been absent for 14 consecutive days (or some other criteria is met or not met) they are automatically removed from the mod group.

The groups page is a more useful place to focus that effort, though.


Note, we are clearly not against this feature, its just a question of priorities and admin pages are usually last to win the priority race

Putting a pr welcome tag on this


Hi! I’m working on this issue, i was able to build some html of sortable users list in admin users list, i also recreate all the necessary steps to call the sortable function but for some reason it doesn’t re-render and so it doens’t sort.

Basically in
i change table titles to:

 {{admin-directory-toggle field="last_seen" order=order asc=asc}}
        {{admin-directory-toggle field="admin.user.topics_entered" order=order asc=asc}}
        {{admin-directory-toggle field="admin.user.posts_read_count" order=order asc=asc}}
        {{admin-directory-toggle field="admin.user.time_read" order=order asc=asc}}

Where admin-directory-toggle is a copy of - but without 'directory.' + on line 11 and line 22, in order to get the correct translation.

Everything seems to work correctly, the order and the field are set as equal and then the bufferedRender is called.
But then the admin template, doesn’t actually reload, which instead the user one, does.
The incongruence is happening here:

I’m bit stack, do i have to do something in particular to make the render, re-render the html?

Or maybe my problem is the tbody of admin table and how is build?
(i notice that /users tbody is all emeberView, instead admin tbody is not. But it doesn’t look like is matching any ids… )

If anyone can point me to direction where to look at, it could keep on from there!


I was able to fix my above issue, now all the frontend part works smoothly: arrow is shown once clicked, page reload and do a call to get elements in the right order, params are added to the query.

Problem? There is no API for that (at least i didn’t find it)

/users table get sorted with a call to directory_items?order=... which works thanks to DirectoryItems model

which make me assume i need something similar for admin user.
i’m not a backend developer so i wouldn’t be able to do this alone, is there any place where i could ask if anyone with enough rails skills would support me?

maybe @erlend_sh you know this?

Yeah this needs to be added…

/admin/users/list/new.json and family should accept a ?sort_column param and a &sort_direction (asc/desc) param

1 Like

@blake can you assist here?

1 Like

@designbygio just letting you know I’m working on the api changes for this :slight_smile:


Okay, here is my PR:

You can sort by these columns:

created_at, trust_level, last_emailed_at, last_seen_at, username, email, days_visited, posts_read_count, topics_entered, post_count, time_read


/admin/users/list/active.json?order=post_count (which defaults to desc)




We should ensure ascending / descending semantics are the same in our various parts of our API.

For homepage we use:

I would recommend normalizing this, for the record I do like asc a bit better


I totally agree!

I did base it off: Discourse Meta :wink:

I’ll make the asc --> to ascending change in my pr and maybe down the road we can update the above url too so that everything is the same.


Okay, done.


Added another pr for mapping order values to database column names:

so that it is more like the /latest endpoint.


@blake many thanks!

What’s the best proceedure now, should I wait your PR to be merged and then i do mine or rather I pull from your PR and do my PR, referring to yours?

Let’s wait for my pr to be merged.