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 » Wed Sep 26, 2007 2:31 am

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 » Wed Sep 26, 2007 1:58 pm

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 » Wed Sep 26, 2007 4:34 pm

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 » Wed Sep 26, 2007 7:59 pm

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 » Wed Sep 26, 2007 10:48 pm

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
Recognised Extension Developer
Posts: 20431
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: phpBB Last post in a forum variable?

Post by RMcGirr83 » Thu Sep 27, 2007 4:14 pm

fetchposts.php (part of ezportal mod) does something very similar to this so you can probably use parts to incorporate into your sql query.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

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 » Fri Mar 14, 2008 2:46 pm

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: 63196
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: phpBB Last post in a forum variable?

Post by Lumpy Burgertushie » Sat Mar 15, 2008 3:42 am

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
I am available for custom work on a donation basis. Please send me a PM with your needs.
Premium phpBB 3.2 Styles by PlanetStyles.net

New phpbb 3.0 support site

Johnny23
Registered User
Posts: 2
Joined: Tue Nov 29, 2005 1:45 pm

Re: phpBB Last post in a forum variable?

Post by Johnny23 » Sun Jul 06, 2008 3:13 pm

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: 63196
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: phpBB Last post in a forum variable?

Post by Lumpy Burgertushie » Sun Jul 06, 2008 11:42 pm

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
I am available for custom work on a donation basis. Please send me a PM with your needs.
Premium phpBB 3.2 Styles by PlanetStyles.net

New phpbb 3.0 support site

Post Reply

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

Who is online

Users browsing this forum: No registered users and 3 guests