phpBB Last post in a forum variable?

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
User avatar
amps7
Registered User
Posts: 13
Joined: Wed Feb 15, 2006 4:30 pm

phpBB Last post in a forum variable?

Post 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.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: phpBB Last post in a forum variable?

Post 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.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
amps7
Registered User
Posts: 13
Joined: Wed Feb 15, 2006 4:30 pm

Re: phpBB Last post in a forum variable?

Post 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?
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: phpBB Last post in a forum variable?

Post 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.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
amps7
Registered User
Posts: 13
Joined: Wed Feb 15, 2006 4:30 pm

Re: phpBB Last post in a forum variable?

Post 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?
User avatar
RMcGirr83
Former Team Member
Posts: 22011
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: phpBB Last post in a forum variable?

Post 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.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
splitsch
Registered User
Posts: 31
Joined: Mon May 21, 2007 11:00 am
Location: Belgium :)
Contact:

Re: phpBB Last post in a forum variable?

Post 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 !
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: phpBB Last post in a forum variable?

Post 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
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
Johnny23
Registered User
Posts: 2
Joined: Tue Nov 29, 2005 1:45 pm

Re: phpBB Last post in a forum variable?

Post 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
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: phpBB Last post in a forum variable?

Post 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
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”