Modify Users column to contain only one avatar (latest poster)

I am currently running Sam’s Minimal theme, but I would like to experiment with the default layout again with only one change: I would want the Users catecory avatars reduced to only one, representing the latest poster.

Sorry if this has been asked before, but I could not find a code example by searching. Anyone done this and could share?

1 Like

CSS Solution

.topic-list .topic-list-item img.avatar:not(.latest) { display: none; }

Thanks, it works great. However, there is a rather massive gap now in between the columns - How to adjust the width of Users accordingly?

1 Like

Here ya go!

.topic-list .posters { width: 50px; min-width: 50px; }

Ok, someone is seriously rocking tonight! Looks pretty good now - time for some user feedback.

Buggers, found one more imperfection - the other columns are aligned to center, but the avatars in Users are aligned to the left.

Just change

.topic-list .posters { width: 50px; min-width: 50px; }


.topic-list .posters { width: 50px; min-width: 50px; text-align: center; }

Maybe targeting the a.latest instead of the td would be an easier approach?

For what? If you want to align something, you have to target its parent to align the items within it appropriately.

I actually tried that already, but it does not seem to align the avatar as expected.

AH, OK, sorry. I missed comprehending what the current issue was. I was thinking it was a “collapse” thing

Time for a food break

Ah, @ljpp that’s because the <a> tag around the avatar has a float. Here is how to fix it, also add this

.topic-list .posters>a { float: none; margin: 0; }

And that solved it. I am guessing that renaming “Users” to “Latest” is a HTML level change, as with the Sam’s minimal theme.

I am going to utilize this on a high volume forum, where the default layout does not work well, as every thread reaches 5+ writers/avatars. So you get a massive wall of random color avatars on the index page.


Theres a closed thread here…

…which does not actually show how to get rid of the blue halo around the avatar. That is obviosuly useless now, as we have sanitized the avatar count to one. I hacked my using Chromes developer tools and got rid of it, but when trying to apply the same via Discourse Customization it does not work. Also the highlighted avatar is misaligned for some reason.

Any ideas how to eliminate the halo and fix alignment.

This looks to be close

.topic-list .posters a:first-child .avatar.latest:not(.single) {
  border: 0px solid transparent;
  top: 2px;
  left: 2px;
  box-shadow: 0 0 0 0;

Here is one thing I suggest everyone to try. I have slightly reduced vertical padding around topic rows, to allow more topics in the view:

.topic-list th, .topic-list td { padding: 8px 5px;}

On my screen Discourse now features ~17 topics, which is comparable to Simple Machines Forum default theme (~19 rows). We have moved to Discourse from SMF, and my users have requested tighter layouts.