Previous Thread
Next Thread
Print Thread
Hop To
Joined: Aug 2004
Posts: 490
Likes: 2
Addict
Addict
Joined: Aug 2004
Posts: 490
Likes: 2
Is there a query to do this (list all display names - not logins - of people who have posted in a particular thread) as I would hate to have to cut&paste them all?

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
This should work. You'd need to change # to the actual topic id.

SQL Query
select t1.USER_DISPLAY_NAME
from ubbt_USERS as t1,
ubbt_POSTS as t2
where t2.TOPIC_ID = '#'
and t1.USER_ID = t2.USER_ID


Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
topic id is harder to get at from just viewing a thread, so i'd do a coupla tweaks:

SQL Query
SELECT DISTINCT u.USER_DISPLAY_NAME
FROM ubbt_USERS u, ubbt_POSTS p
WHERE p.TOPIC_ID=(SELECT TOPIC_ID FROM ubbt_TOPICS WHERE POST_ID='#')
AND u.USER_ID = p.USER_ID
ORDER BY u.USER_DISPLAY_NAME

tweak 1: use post id instead (it's displayed for each post in the entire thread and you can choose any one you'd like)
tweak 2: add 'DISTINCT' so as to not have multiples per user
tweak 3: order the list alphabetically for sanity

optional approach #2, if you wanted to present the list of users in a topic and ALSO show how many times they've posted there:

SQL Query
SELECT count(u.USER_DISPLAY_NAME), u.USER_DISPLAY_NAME
FROM ubbt_USERS u, ubbt_POSTS p
WHERE p.TOPIC_ID = (
SELECT TOPIC_ID
FROM ubbt_TOPICS
WHERE POST_ID ='#' )
AND u.USER_ID = p.USER_ID
GROUP BY u.USER_DISPLAY_NAME
ORDER BY u.USER_DISPLAY_NAME

final tweak, if this is a long ass thread and you might have even banned some peeps who posted there.

SQL Query
SELECT count(u.USER_DISPLAY_NAME), u.USER_DISPLAY_NAME
FROM ubbt_USERS u, ubbt_POSTS p
WHERE p.TOPIC_ID = (
SELECT TOPIC_ID
FROM ubbt_TOPICS
WHERE POST_ID ='#' )
AND u.USER_ID = p.USER_ID
AND u.USER_ID > 1
GROUP BY u.USER_DISPLAY_NAME
ORDER BY u.USER_DISPLAY_NAME

just ignores 'famous' user number 1

2c

Joined: Aug 2004
Posts: 490
Likes: 2
Addict
Addict
Joined: Aug 2004
Posts: 490
Likes: 2
Many thanks for the help, guys! smile And all this time I was cuttin' and pastin' each and every name into a text file...lol.

Which tweak deals with persons that are currently banned? Will they be dropped from the list or highlighted in some other way?

Or maybe there is another query that I can run that will display just the banned (temp or time ban) members who posted in that thread so I can check them out manually?

Joined: Aug 2004
Posts: 490
Likes: 2
Addict
Addict
Joined: Aug 2004
Posts: 490
Likes: 2
Originally Posted by Sirdude
topic id is harder to get at from just viewing a thread, so i'd do a coupla tweaks:

SQL Query
SELECT DISTINCT u.USER_DISPLAY_NAME
FROM ubbt_USERS u, ubbt_POSTS p
WHERE p.TOPIC_ID=(SELECT TOPIC_ID FROM ubbt_TOPICS WHERE POST_ID='#')
AND u.USER_ID = p.USER_ID
ORDER BY u.USER_DISPLAY_NAME

tweak 1: use post id instead (it's displayed for each post in the entire thread and you can choose any one you'd like)
tweak 2: add 'DISTINCT' so as to not have multiples per user
tweak 3: order the list alphabetically for sanity

This query worked for me before but for some reason I have been unable to run it today. Any idea why it would suddenly stop working?

Joined: Aug 2004
Posts: 490
Likes: 2
Addict
Addict
Joined: Aug 2004
Posts: 490
Likes: 2
Ok, dunno why but it suddenly started working again. Case closed. smile

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
[Linked Image from sirdude.com]


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
After server reboot
by Morgan - 09/02/2026 8:27 AM
Email Settings
by Outdoorking - 05/13/2026 2:44 AM
Who's Online Now
1 members (1 invisible), 304 guests, and 96 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)