How I can change the default avatar in the list of recent post in home page? I need to show the avatar of the original author of post, not the last participant, because if I respond at last, all avatars are my ugly face…
AI-generated summary
The discussion revolves around changing the default avatar displayed in the home page’s recent posts list to show the original author instead of the last responder. mcarvajal initiated the query, noting that the current behavior shows the avatar of the last participant, which can be undesirable. codinghorror explained that this is by design to avoid repetitive avatars. Neso and davidkingham expressed interest in modifying this behavior. Johani provided a technical solution involving a theme override to replace topic.lastPoster with topic.creator in the latest-topic-list-item template, referencing the relevant GitHub file and theme customization guide. davidkingham confirmed the solution worked successfully.
That’s the way it works. If avatars are always the first poster they get very monotonous over time, since the first poster never changes.
But is there a way to do it?
Best regards,
Neso
I would like to dredge this back up. For our particular needs I would much prefer to show the original post author on latest rather than the last reply author. Is it even possible or is this so embedded in core that it couldn’t be done with a plugin?
If you’re referring to the “latest” list on the categories page, then this is what you need to change:
If you want the avatar of the topic creator, you need to pass that instead, so you go from
{{#user-link user=topic.lastPoster}}
{{avatar topic.lastPoster imageSize="large"}}
{{/user-link}}
to
{{#user-link user=topic.creator}}
{{avatar topic.creator imageSize="large"}}
{{/user-link}}
So something like this in the header section of your theme
<script type="text/x-handlebars" data-template-name="components/latest-topic-list-item">
<div class='topic-poster'>
{{#user-link user=topic.creator}}
{{avatar topic.creator imageSize="large"}}
{{/user-link}}
</div>
<div class='main-link'>
<div class='top-row'>
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{#if topic.featured_link}}
{{topic-featured-link topic}}
{{/if}}
{{topic-post-badges newPosts=topic.totalUnread unseen=topic.unseen url=topic.lastUnreadUrl}}
</div>
<div class='bottom-row'>
{{category-link topic.category}}
{{discourse-tags topic mode="list"}}
</div>
</div>
<div class='topic-stats'>
{{raw "list/posts-count-column" topic=topic tagName="div"}}
<div class="topic-last-activity">
<a href="{{topic.lastPostUrl}}" title="{{topic.bumpedAtTitle}}">{{format-date topic.bumpedAt format="tiny" noTitle="true"}}</a>
</div>
</div>
</script>
there’s more on template overrides here
This works absolutely brilliantly, thank you Joe!
