Page 1 of 1

phpBB Last post in a forum variable?

Posted: Wed Sep 26, 2007 2:31 am
by amps7
Hey.
I was wondering if there was such a variable as one which contained the last post in a certain forum? I mean to display this on an external page ive set up using session integration. Oh ya, and if not is there a variable for who is online?

Cheers.

Amps.

Re: phpBB Last post in a forum variable?

Posted: Wed Sep 26, 2007 1:58 pm
by drathbun
The "last post" for a forum is linked in forum_last_post_id in the phpbb_forums table. That will at least point you to the post, you'll need more information from other tables.

The "who's online" information is taken from the phpbb_sessions table.

Since it appears you are writing come code, I will move your post to the MOD Writers forum for further attention. Thanks.

Re: phpBB Last post in a forum variable?

Posted: Wed Sep 26, 2007 4:34 pm
by amps7
Ah, thanks drathbun. Im new to this though so what im trying to do here is get the id from the php_forum table then that will give me the number to fit into the:

http://www.myforum.com/forum/viewtopic.php?p=XXXX#XXXX

where XXXX is the reference to the topic and post?

Then ive got to somehow get the contents of that post and poster username etc.

As for the "Who is online" list, to display that externally I have to retrieve all the "session_user_id" then match the ids to the usernames?

If thats right, could anyone explain a bit more?

Re: phpBB Last post in a forum variable?

Posted: Wed Sep 26, 2007 7:59 pm
by drathbun
If you know SQL, the steps you need are:

phpbb_forums.forum_last_post_id = phpbb_posts.post_id
phpbb_posts_id = phpbb_posts_text.post_id

That gives you the post content. Add:

phpbb_posts.poster_id = phpbb_users.user_id

That gets you to the user table where you can get the username and so on.

Re: phpBB Last post in a forum variable?

Posted: Wed Sep 26, 2007 10:48 pm
by amps7
Ah ok, I don't know how to code SQL im just used to using phpmyAdmin to deal with all SQL related things through that interface. Any tips?

Re: phpBB Last post in a forum variable?

Posted: Thu Sep 27, 2007 4:14 pm
by RMcGirr83
fetchposts.php (part of ezportal mod) does something very similar to this so you can probably use parts to incorporate into your sql query.

Re: phpBB Last post in a forum variable?

Posted: Fri Mar 14, 2008 2:46 pm
by splitsch
Hello,

I bump this topic, because I need to use this kind of code.
I have a forum, and I'dl like to show the 5 last post on an external page, on the same host and same db.

Does anyone know how to do this?

thanks !

Re: phpBB Last post in a forum variable?

Posted: Sat Mar 15, 2008 3:42 am
by Lumpy Burgertushie
splitsch wrote:Hello,

I bump this topic, because I need to use this kind of code.
I have a forum, and I'dl like to show the 5 last post on an external page, on the same host and same db.

Does anyone know how to do this?

thanks !
there are many different MODs for this type of thing. your best bet may be phpbbfetchall.

google for it.

robert

Re: phpBB Last post in a forum variable?

Posted: Sun Jul 06, 2008 3:13 pm
by Johnny23
Nice advice robert, but the only fetchall that is found works only on phpbb 2. I'm looking for this kind of script too.

This might be a good alternative: http://www.phpbb.com/mods/db/index.php? ... ib_id=2925

Didn't try it out yet, just found it

Re: phpBB Last post in a forum variable?

Posted: Sun Jul 06, 2008 11:42 pm
by Lumpy Burgertushie
Johnny23 wrote:Nice advice robert, but the only fetchall that is found works only on phpbb 2. I'm looking for this kind of script too.

This might be a good alternative: http://www.phpbb.com/mods/db/index.php? ... ib_id=2925

Didn't try it out yet, just found it
well, this is the phpbb2 mod writers forum you know.


robert