Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

99 users online



SMF getting recent posts by user

SMF getting recent posts by user

Currently viewing this thread: 1 (0 members and 1 guests)


celldamage

celldamage

dahnhilla
Status: Offline!

SMF getting recent posts by user

Basically what I want to do is like NS does in profiles, e.g. http://celldamage.neverside.com/ you can see at the bottom my 5 most recent posts.
I use SMF (www.simplemachines.org) but their coding support is next to useless, so i'm asking where people will know Wink

Theres basically two tables I need to query.
smf_messages - where the information about each post is stored, along with secondary keys (e.g. ID_MEMBER) which link to which member posted it, etc.
smf_boards - The name of the board in which its posted.

Table structures:
smf_messages
ID_MSG (primary key)
ID_TOPIC
posterTime
ID_MEMBER
ID_MSG_MODIFIED
subject
posterName
posterEmail
posterIP
smileysEnabled
modifiedTime
modifiedName
body
icon
ID_BOARD

smf_boards
ID_BOARD (primary key)
ID_CAT
childLevel
ID_PARENT
boardOrder
ID_LAST_MSG
ID_MSG_UPDATED
lastUpdated
memberGroups
name
description
numTopics
numPosts
countPosts
ID_THEME
permission_mode
override_theme

So I already have ID_MEMBER, so we'll say that its 1 for ease.
I've looked at the code SMF used, and its built very heavily into the forum itself, and practically impossible to remove without bringing a LOT of files with it (its all interlinked, and checks for a million different circumstances, which i dont care about)

It uses a lot of JOINS, which i'm not too hot on.
I think the algorithm would be roughly:

SELECT
(from smf_messages)
posterTime, subject, ID_TOPIC, ID_MEMBER, ID_MSG, ID_BOARD
(from smf_boards)
name

WHERE
smf_messages.ID_MEMBER = 1
smf_boards.ID_BOARD = smf_messages.ID_BOARD
LIMIT 5

After all that, i'll display them like:
TOPIC TITLE in BOARD TITLE DATE
(like NS does)

I really hope someone understood that! Any help would be amazing Smile
Much thanks for reading thus far Wink

___________________

http://elixant.co.uk/banner.jpg http://ftmb.net/mystuff/ftmbmini.gif

Last edited by celldamage, April 9th, 2006 10:17 PM (Edited 1 times)

Kickboy

Kickboy

Neverside Newbie
Status: Offline!

Try something like this (untested):

Code:

SELECT m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD
FROM smf_messages AS m, smf_boards AS b
WHERE m.ID_MEMBER = 1 AND b.ID_BOARD = m.ID_BOARD
ORDER BY m.posterTime DESC LIMIT 5

Let me know if that helps.

___________________

I don't suffer from insanity; I enjoy every minute of it.
Unintended Theory | Cacrew v4

celldamage

celldamage

dahnhilla
Status: Offline!

Mate you're a genius. Worked first time Grin Thank you so much.

___________________

http://elixant.co.uk/banner.jpg http://ftmb.net/mystuff/ftmbmini.gif

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.007 seconds.