DF-21 Forums Forum Index DF-21 Forums
The Dark Forces Community
 
DF-21.net Home | FAQ | Search | Memberlist  | Register 
Profile | Log in to check your private messages | Log in

Member list

 
Post new topic   Reply to topic    DF-21 Forums Forum Index -> Feedback
View previous topic :: View next topic  
Author Message
Darth Oosha
Trandoshan

Joined: 24 Sep 2003

PostPosted: Dec 05, 2007 02:44    Post subject: Member list View user's profile Send private message Reply with quote

Just out of curiosity: Would it be easy to write a script to display a list of members sorted by date of most recent post, so you can see the actual current inhabitants of the board?

Tom Manning
Trandoshan

Joined: 27 Sep 2003

PostPosted: Dec 05, 2007 02:51    Post subject: View user's profile Send private message Send e-mail Reply with quote

I'm still here!

_________________
Tom Manning
For all that you hold dear on this good Earth, I bid you, Stand, Men of the West!
Aragorn: Return of the King

Fenwar
Admiral Ackbar
Admiral Ackbar

Joined: 15 Sep 2003

PostPosted: Dec 07, 2007 07:49    Post subject: View user's profile Send private message Reply with quote

Definitely possible, shouldn't be too hard to do. Will have a look at the code when I next have my SQL hat on.

Nottheking
Kell Dragon

Joined: 29 Sep 2003

PostPosted: Dec 09, 2007 19:17    Post subject: View user's profile Send private message Reply with quote

We're counting on you, Fenwar. :p

(and yeah, I'm still here!)

_________________
Wake up, George Lucas... The Matrix has you..

The MAZZTer
Death Star
Death Star

Joined: 25 Sep 2003

PostPosted: Dec 12, 2007 00:46    Post subject: View user's profile Send private message Send e-mail Reply with quote

[Edit: Maybe it won't be so easy]

It might be easy if that data is stored in the members table. If not, you would have to make a separate query FOR EACH MEMBER to pull up their most recent post to get the timestamp from it.

A better way would be to add a field to the members table (if one doesn't already exist of course) and add an UPDATE query whenever a user makes a post to update the timestamp there. Then to populate a memberlist you just need one simple query like it does now.

_________________
http://www.mzzt.net/ | I am a respectable admin with a respectable sig.

Fenwar
Admiral Ackbar
Admiral Ackbar

Joined: 15 Sep 2003

PostPosted: Dec 12, 2007 09:29    Post subject: View user's profile Send private message Reply with quote

There's already a column in the users table for your last "visit" (I presume, last login) which would out any lurkers among us.

I don't think you need multiple queries to get the last 10 users who posted though:

Code:

SELECT username, poster_id, MAX(post_time) AS last_post_time
 FROM `phpbb_posts` JOIN `phpbb_users` ON user_id = poster_id
 GROUP BY poster_id
 ORDER BY last_post_time DESC
 LIMIT 0,10


Which in phpMyAdmin as I write this returns

Code:

username        poster_id   last_post_time
The_Mega_ZZTer  16          1197420396
Fella           376         1197395987
Fenwar          3           1197394811
DarthDoctor     32          1197294263
Nottheking      34          1197228179
ACE             373         1197071335
milo_antu       326         1197066740
CoinCollector   374         1197065913
Patrick Haslow  15          1197062024
Darth Oosha     7           1197000664


...looks about right to me Smile

Fenwar
Admiral Ackbar
Admiral Ackbar

Joined: 15 Sep 2003

PostPosted: Dec 12, 2007 09:34    Post subject: View user's profile Send private message Reply with quote

And after that last post makes me the most recent poster, the same query gives:

Code:

username        poster_id   last_post_time
Fenwar          3           1197451784
The_Mega_ZZTer  16          1197420396
Fella           376         1197395987
DarthDoctor     32          1197294263
Nottheking      34          1197228179
ACE             373         1197071335
milo_antu       326         1197066740
CoinCollector   374         1197065913
Patrick Haslow  15          1197062024
Darth Oosha     7           1197000664


(PS: ugh @ phpBB code tag which converts tabs to 4 spaces - when in my edit window a tab uses 8 columns... Evil or Very Mad )

So now all I have to do is add that to the actual phpBB code somewhere. Woo.

Fenwar
Admiral Ackbar
Admiral Ackbar

Joined: 15 Sep 2003

PostPosted: Dec 12, 2007 11:12    Post subject: View user's profile Send private message Reply with quote

It. Is. Done.

The MAZZTer
Death Star
Death Star

Joined: 25 Sep 2003

PostPosted: Dec 12, 2007 17:31    Post subject: View user's profile Send private message Send e-mail Reply with quote

I don't think the GROUP BY clause actually does anything in this query?

_________________
http://www.mzzt.net/ | I am a respectable admin with a respectable sig.

Fenwar
Admiral Ackbar
Admiral Ackbar

Joined: 15 Sep 2003

PostPosted: Dec 12, 2007 21:05    Post subject: View user's profile Send private message Reply with quote

It's so that the MAX(post_time) can select the highest value that applies to each unique user. (I think using MAX() alongside other columns is invalid SQL without it.)

It is quite a hefty query when added to the existing phpBB code for the memberlist page, as it pulls pretty much all of the columns from the users table and now I've added the JOIN which uses all the rows of the posts table.

The method you originally suggested would definitely be more efficient in the long run though (especially as our database gets bigger), but MySQL seems to be handling this OK for now, and it's marginally easier to hack the SELECT statements in the phpBB code than UPDATES Wink

Nottheking
Kell Dragon

Joined: 29 Sep 2003

PostPosted: Dec 14, 2007 02:52    Post subject: View user's profile Send private message Reply with quote

Nice... Seems that we're not QUITE as dead as it seemed before!

_________________
Wake up, George Lucas... The Matrix has you..

Darth Oosha
Trandoshan

Joined: 24 Sep 2003

PostPosted: Dec 15, 2007 00:24    Post subject: View user's profile Send private message Reply with quote

Feature: approved. Also: I'm not sure whether I should be proud or depressed that I've apparently been around longer than almost anyone still here.

Nottheking
Kell Dragon

Joined: 29 Sep 2003

PostPosted: Dec 16, 2007 03:59    Post subject: View user's profile Send private message Reply with quote

Darth Oosha wrote:
Feature: approved. Also: I'm not sure whether I should be proud or depressed that I've apparently been around longer than almost anyone still here.


Remember that member ID is based upon order of registration into the database used here... And that this was started anew back in the fall of 2003 when the old DF-21 forums went kaput. 'tis why I have more posts here than anyone else, including, say, Barry Brien. (the loss of all of his post-count from the old forums was clearly a traumatic experience for him...)

_________________
Wake up, George Lucas... The Matrix has you..

Darth Oosha
Trandoshan

Joined: 24 Sep 2003

PostPosted: Dec 16, 2007 21:16    Post subject: View user's profile Send private message Reply with quote

I was actually calculating based on which names I recognized from DF99, and the Code Alliance and Bespin City forums before that.

Nottheking
Kell Dragon

Joined: 29 Sep 2003

PostPosted: Dec 22, 2007 00:37    Post subject: View user's profile Send private message Reply with quote

Darth Oosha wrote:
I was actually calculating based on which names I recognized from DF99, and the Code Alliance and Bespin City forums before that.


I was trying to cheer you up, man! Sad

(also: 2000th post on this particular incarnation of the forums. No cause to celebrate)

_________________
Wake up, George Lucas... The Matrix has you..

Display posts from previous:   
Post new topic   Reply to topic    DF-21 Forums Forum Index -> Feedback All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group