Any way to remove columns in the users page?

AI-generated summary

Users are seeking a way to remove columns from the Users page in Discourse. Specifically, b481 wants to remove “visits”, “viewed”, and “read” columns, while Jonathan5 aims to remove “Likes received”, “Likes given”, and “Days visited” columns.

One possible solution is to use custom CSS, as suggested by Falco. Jonathan5 provided a CSS code snippet that hides specific columns by targeting th and td elements based on their child position. However, this approach may break if Discourse changes its user directory structure.

Alternatively, Canapin suggested overriding existing page templates, pointing to a guide on Meta Discourse.

Specifically looking to remove the visits, viewed and read columns from the Users (at www.example.com/u and www.example.com/users) page, but haven’t found a way as of yet. Anyone know if it’s possible?

1 Like

I you just want to hide it from the interface you can certainly do it with custom CSS.

4 Likes

I have the same query. I would like to remove the “Likes received”, “Likes given” and “Days visited” columns.

I can’t work out how to do it via CSS. The columns appear to be made up of td elements all of class “number” but with no id.

Is it possible?

I know the nuclear option is to change the “enable user directory” setting.

Thanks.

2 Likes

Ok here we go. This will break if Discourse changes its user directory structure but is the best I can do in the absence of anything identifying each element of the table. It goes in the CSS part of a custom theme component.

div.users-directory table th:nth-child(2), 
div.users-directory table th:nth-child(3), 
div.users-directory table th:nth-child(8), 
div.users-directory table td:nth-child(2), 
div.users-directory table td:nth-child(3), 
div.users-directory table td:nth-child(8) {
    display:none;
}

I have a feeling it could be written better but it seems to work and doesn’t seem to break other tables.

1 Like

What you want to achieve can be done by overriding the existing page templates. There is an example of a column removal here:

2 Likes

Thank you. I will look into this, though most likely will keep what I have for now :slight_smile:

Though I’ve spotted that the “All time” user directory page has a 9th column I’d like to hide too.