The discussion revolves around the ‘featured users’ feature in Discourse, which displays avatars of users next to the topic author in topic lists. gassim inquires about the purpose and functionality of the featured_user columns in the topics table, noting discrepancies between the UI and query results. JammyDodger explains that the first avatar is the topic owner, followed by featured_user1, featured_user2, etc., with last_post_user_id also playing a role. gassim clarifies confusion about why some featured users appear in the UI but not in queries, and JammyDodger provides examples showing how users cycle through the featured slots based on replies, resolving the confusion. gassim confirms understanding and thanks the explanation.
Hi
I see a number of columns in the topics table in the Data Explorer called “Featured_user…” and it’s rarely mentioned anywhere on Discourse with description of what it is and how it functions (or that I wasn’t able to find the source)?
Would be grateful for an explanation or a reference, please! Thank you! (:
The first avatar would be the topic owner (topic.user_id), and the second would likely be the featured_user1, and the third last_post_user_id
You could try this and see if it marries up with what your topic list shows:
-- [params]
-- integer :topic_id
SELECT t.id as topic_id,
t.user_id as topic_owner_user_id,
t.featured_user1_id as F1_user_id,
t.featured_user2_id as F2_user_id,
t.featured_user3_id as F3_user_id,
t.featured_user4_id as F4_user_id,
t.last_post_user_id
FROM topics t
WHERE t.id = :topic_id
Okay thanks a lot, and sorry if I wasn’t able to explain this properly from the start, but in my example above, it shows three users (yes the first user is the owner) but in the query result only one user appears to be a featured_user so my question is how come in the query it chose to display one user and not the other whom is visible in the UI? (without including the topic owner - that’s understood)
I expect it to display two featured users + the owner, like we have it in the UI (: