# 分类列表中的原始发帖人

**URL:** <https://meta.discourse.org/t/original-posters-within-a-category-list/151511>\
**Category:** Support\
**Created:** [2020年五月14日 16:50 UTC](https://meta.discourse.org/t/original-posters-within-a-category-list/151511 "2020-05-14T16:50:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pw3010](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pw3010/32/180429_2.png) [@pw3010](https://meta.discourse.org/u/pw3010)\
**Post date:** [2020年五月14日 16:50 UTC](https://meta.discourse.org/t/original-posters-within-a-category-list/151511/1 "2020-05-14T16:50:04Z")

</div>

我使用的是 @pfaffman 的 [Feverbee](https://github.com/literatecomputing/feverbee-engagement-theme) 模板作为自定义的基础，但在论坛中搜索许久后，仍无法解决遇到的问题。以下示例部分显示了来自特定类别的最新 3 条帖子：

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/c/1c109f6c5f3ec9852df62e5fd7ca78227202e90d.png)

然而，我似乎无法将用户头像更改为原始发帖人的头像，而不是最新回复者的头像。我认为类别的 JSON 数据中并未传递该信息，而我在尝试添加它时束手无策。

我需要做出这一更改，因为最新发帖人可能是我们的支持团队成员，而不是需要帮助的人。

---

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2020年五月16日 02:50 UTC](https://meta.discourse.org/t/original-posters-within-a-category-list/151511/2 "2020-05-16T02:50:42Z")

</div>

好的，你需要拉取用户数据……你可以将 topicListThree 部分编辑为：

```js
  ajax("/latest.json?order=posts&ascending=true").then (function(result){
                     topicListThree = [];
                    var usersThree = result.users;
                    result.topic_list.topics.slice(0,3).forEach(function(topic){
                        topic.posters.forEach(function(poster){
                            poster.user = $.grep(usersThree, function(e){ return e.id == poster.user_id; })[0];
                        });
                        topicListThree.push(Topic.create(topic));
                    });
                    component.set('topicListThree', topicListThree);
                });

```

然后在模板中，你可以将 img src 中的 `{{topic.last_poster_username}}` 部分替换为 `{{topic.posters.[0].user.username}}`

---

<div class="post-metadata">

**Author:** ![pw3010](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pw3010/32/180429_2.png) [@pw3010](https://meta.discourse.org/u/pw3010)\
**Post date:** [2020年五月18日 09:58 UTC](https://meta.discourse.org/t/original-posters-within-a-category-list/151511/3 "2020-05-18T09:58:33Z")

</div>

太棒了，谢谢 @awesomerobot。我已经完成了三分之二，但还需要你的帮助才能最终完成！

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2020年六月17日 10:15 UTC](https://meta.discourse.org/t/original-posters-within-a-category-list/151511/5 "2020-06-17T10:15:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
