XF 2.2 SQL to get all posts by a user

thenashy

Active member
Is anyone able to help with with what SQL query I should be running to show all posts and post time of a particular user. We've been asked to retrieve and send this data. Or is there a better way than SQL?

Searching only that users posts is not enough unfortunately, I need to full post info able to be downloaded.

Thanks for any assistance.
 
SQL:
SELECT `username`, `post_date`, `message` FROM `xf_post` WHERE `user_id` = 1

Or even just:
SQL:
SELECT `post_date`, `message` FROM `xf_post` WHERE `user_id` = 1

Change the 1 to the ID of the member.
The timestamps are UNIX time format - tell them they can convert them here: https://www.unixtimestamp.com/index.php

If you want to be nice and give them the formatted times, use:
SQL:
SELECT from_unixtime(`post_date`) as timestamp, `message` FROM `xf_post` WHERE `user_id` = 1
 
Top Bottom