PDA

View Full Version : [Release vB2.0] PM Stats 1.0


The_Sisko
Fri 20th Apr '01, 3:09pm
PM Stats 1.1 Hack | 28.05.2001-22:10 CET

What does it do:
This Hacks show some stats for your PM's, which includes:

Version 1.0
It show per page all users who stores PM's in the database, sort by users with the most PM's.
It shows: total PM's, new PM's and unread PM's
Total PM's in database
How many Users with at least one PM are in db
Users PM average
it highlight users who stores more then 90% of the current PM quota, so you can find those users fast.
Updated Version 1.1
link to userprofile for direct edit (this one was requested)
delete all PM's of one user (this one was requested)
the last part is a little big tricky to explain: you can know see the Last Visit, Last Activity, Last Post of an user in different colors. What is it good for? Lets say you can easy see if an user is inactive and you can delete his PM's to keep your database clean. If there need to explain more, take a look at the screenshot or ask me and I'll try to explain it more.


I found this very usefull so I can trackdown which user stores how many PM's and how to set the PM quota. This idea is only usefull for those of us, who had some server limitation and like to find ways to keep the diskquota of the database small.

For version: vBulletin 2.0.0 (should work with RC2 and RC3, but for odler versions the CSS is missing).

Files needed: pmstats.php

Files to edit: pmstats.php

Templates to create/edit: none

Instructions are in pmstats.php file.

Screenshot http://www.studenten-city.de/stf/pmstats.jpg

FEEDBACK WANTED! :D Likes/dislikes/modification requests all gladly accepted.

rockergrrl
Fri 20th Apr '01, 3:19pm
Works Great!!

I've been wondering about the numbers of PMs my girls have have storing... :)

Thanks!!

The_Sisko
Fri 20th Apr '01, 3:21pm
For those of you who want a link form the CP:

In /admin/index.php find first instance:<tr><td><hr></td></tr>under it place:<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#3F3849"><td><font color="#BCB6CD">
<b>PM Functions</b>
</font></td></tr></table>
<a href="pmstats.php?s=<?php echo $session[sessionhash]; ?>">PM Stats</a><br>
</td></tr>reupload it!

tubedogg
Fri 20th Apr '01, 3:24pm
I love it! :)

Even if you did borrow ;) my release wording.

The_Sisko
Fri 20th Apr '01, 4:41pm
Originally posted by tubedogg
I love it! :)

Even if you did borrow ;) my release wording.

Thx :) and sorry for taking your release wording :D, but were the best I could find!!!:)

SystemLogic
Fri 20th Apr '01, 6:26pm
Looks great!!!

bokhalifa
Fri 20th Apr '01, 11:06pm
Great ;)

Blue2000
Sun 29th Apr '01, 8:35pm
this is very nice Sisko.

i know its only a stats but is there anyway you could turn it into a maintains/stats hack and add a delete all read messages next to there names? (just an idea) great hack tho dude

The_Sisko
Mon 30th Apr '01, 2:57pm
Originally posted by Blue2000
this is very nice Sisko.Thx :)Originally posted by Blue2000
i know its only a stats but is there anyway you could turn it into a maintains/stats hack didn't get it?:confused: Can you explain it a little more for me? Originally posted by Blue2000
and add a delete all read messages next to there names? (just an idea) great hack tho dude Great Idea, will try to add it in the next few days!

Blue2000
Tue 1st May '01, 8:47am
Originally posted by The_Sisko
Thx :)didn't get it?:confused: Can you explain it a little more for me?


yeah you did get it :D


Great Idea, will try to add it in the next few days!

NickyNet
Tue 1st May '01, 3:37pm
great hack..

thx

Flare
Tue 1st May '01, 4:11pm
Nice hack! Thank you very much :)

jojo85
Thu 3rd May '01, 6:49am
It's a really nice idea cause at the moment there were only the page and threads stats
thx youuu

Zarkov
Wed 23rd May '01, 11:48am
Thanks for this i could do with this to see who's doin what with the space

GhostMaster
Sat 26th May '01, 12:15pm
can Admin empty, insert also a User pm box?
that would not badly be if that possible were

krohn
Sun 27th May '01, 8:32pm
dear god.... We've got over 5k PM's sitting in our db! the average user has 10PM's

The_Sisko
Mon 28th May '01, 4:36am
Originally posted by GhostMaster
can Admin empty, insert also a User pm box?
that would not badly be if that possible were

Yes he cann do so in the next version...I forgot to publish my ready next version. I'll post it when I'm at home.

Features:

Admin can now delete all PM's of a user with one click
Some kind of grafic stats (colors) about how active a user is, to chose if you like to delete the users PM's .


Will check older posts if there is more to do, if not, I will release it this evening (CET +1)

jucs
Mon 28th May '01, 8:09am
Did anyone recommend this for 2.1? It should be!:)

The_Sisko
Mon 28th May '01, 5:18pm
UPDATED VERSION 1.1

Go to first post in this thread for more infos!!!!!

jucs
Mon 28th May '01, 7:05pm
3 users have a last post of:

31-12-69
19:00:00

It shows these in red. Not likely they posted in 1969! :)

And there is a .php3 extension used in the file so if one doesn't use php3 extensions it will give you an error when clicking on the links for users.

Great hack. This should be put in the next release.

krohn
Mon 28th May '01, 10:09pm
How about something to auto delete all PM's stored by people who haven't visited in like a month?

Being able to delete things sure does help! Good job man :)
What are your plans on expanding even further? something like deleting messages older than like 2 months or something?

Vbulletin should be able to limit how long PM's are stored...

Blue2000
Mon 28th May '01, 10:11pm
nice update mate well done

Blue2000
Mon 28th May '01, 10:26pm
dude when i press 2 at the top of the page i get a page could not be displayed error

krohn
Mon 28th May '01, 10:34pm
yeah I noticed a few .php3 tags in the code

do a quick search for .php3 in the code and delete the 3... it's in either 2 or 3 places I can't remember. But everythings working great for me after that quick fix.

try the file I attached...

The_Sisko
Tue 29th May '01, 4:14am
I've updated the zip file and changed all .php3 to .php

jucs
Tue 29th May '01, 6:37am
3 users have a last post of:

31-12-69
19:00:00

It shows these in red. Not likely they posted in 1969!

The_Sisko
Tue 29th May '01, 8:42am
Did you import from UBB?

RobAC
Tue 29th May '01, 9:14am
First of all nice job!!!

Second, I have that same problem with the last post showing up in 1969 for users that have never posted. I imported from UBB and ran an update script that Tubedogg told me about to fix the dates, which worked in some areas of my forums, but not in all. Any ideas?

The_Sisko
Tue 29th May '01, 10:21am
RobAC and jucs,

try to go and edit one of the 1969 user in the CP and take a look at last post time. Does it be the same prob with the time, or only in my hack?

RobAC
Tue 29th May '01, 10:43am
No, it's not only in your hack but in other parts of the standard CP.

jucs
Tue 29th May '01, 12:59pm
It is in the regular CP readout as well...

I did a clean install of V2.0. No importing from UBB was performed.

Now what?

Is this a V2.0 bug of some sort?

jucs
Tue 29th May '01, 1:34pm
Last Post Bug in V2.0? (http://www.vbulletin.com/forum/showthread.php?postid=116787#post116787)

eva2000
Tue 29th May '01, 2:41pm
i just installed v1.1 and it's great but what's this about a bug ?

RobAC
Tue 29th May '01, 2:53pm
Originally posted by eva2000
i just installed v1.1 and it's great but what's this about a bug ?

Well, looks like we have 2 separate bugs going on. One was the use of php3 extensions which was causing a problem when trying to view the next page of pms, but Sisko fixed that and re-uploaded the pmstats.php file to the top of this thread this morning I believe. So...basically, that's fixed, but the next one is what a lot of us have been seeing and that's the 1969 dates. I don't think it's got to with Sisko's hack, but rather a UBB importation problem for those of us who imported from UBB. I could be wrong.

The_Sisko
Tue 29th May '01, 4:27pm
All ZERO post users got this timestamp.......!

Blue2000
Thu 31st May '01, 7:45am
nice one dude now you have fixed that php3 code it works great

The_Sisko
Thu 31st May '01, 7:48am
Just want to mention, a lot of people ask me to modify the hack to read the PM of an user.

I'll wont do this! Private means private and so it should be. Please stop asking me for this one!

etones
Thu 31st May '01, 8:16am
Nice Hack Sisqo... great stuff.

I look forward to your upgrade on Overgrows Mod log hack... nice.

lichtflits
Fri 1st Jun '01, 9:05am
when I deleted all post of a member I'll see this: All PM's from .... has been deleted!
that ok.
but is it posible that the page automatic going back to the main pmstats page? (admin/pmstats.php)

cditty
Sat 9th Jun '01, 3:07pm
I have seen mention of colors but no definition of them. What do the the colors stand for?

Thanks.

Nice mod.

Chris

Zarkov
Sun 10th Jun '01, 5:26am
the lastactivity, lostpost & lastvisit date & times are colour coded Green for less than a week, Blue for 1 - 2 weeks old, and red for any date older that 14 days.

Zarkov
Sun 10th Jun '01, 5:47am
Ive come up with this to stop the date problem
In pmstats.php

Find

$lastpost = strftime("%d-%m-%y<br>%H:%M:%S", "$user[lastpost]");

and replace with

if ($user[lastpost]==0){
$lastpost = "Never Posted";
} else {
$lastpost = strftime("%d-%m-%y<br>%H:%M:%S", "$user[lastpost]");
}

All it does it looks for a dateline of 0 (no date) and sets $lastpost to Never Posted instead of the date.

ibeblunt
Wed 20th Jun '01, 2:27pm
If the originator of this hack is reading this, how about a hack to be able to delete all PM's over a certain amount of days? Like delete PM's over [x] days old.

Jpp
Thu 21st Jun '01, 2:43pm
Warning: Division by zero in C:\HTTPD\upload\admin\pmstats.php on line 59

can anyone tell me why??

The_Sisko
Thu 21st Jun '01, 2:53pm
You don't have any PM's on the board, so you got this error. I need to add a if command for fixing this one...

Jpp
Thu 21st Jun '01, 5:10pm
Originally posted by The_Sisko
You don't have any PM's on the board, so you got this error. I need to add a if command for fixing this one...

But i do!! I got 122 Pm's in the database, 19 users with at least one

The_Sisko
Thu 21st Jun '01, 5:58pm
Did you installed this other stats hack you shows how many active user there are? This hacks adds a variable $limit to the boards, which I'm using too! You need to change then $limit in pmstats (all of it) to something else: e.g. $limit_pm

Jpp
Thu 21st Jun '01, 6:07pm
Originally posted by The_Sisko
Did you installed this other stats hack you shows how many active user there are? This hacks adds a variable $limit to the boards, which I'm using too! You need to change then $limit in pmstats (all of it) to something else: e.g. $limit_pm

Yes it helped :) Thank's a lot

pwr_sneak
Wed 4th Jul '01, 10:31am
Hi,

i just installed this hack on my Board for the first time an tried to access the stats. I was wondering why it didn't show up, checked my server and saw one HTTP-Process using 150 Megs of RAM....

After restarting Apache i took a look at the script ;(
There are lots of MYSQL Queries returning huge unused arrays.

I like this hack, but i have to rewrite it for my board for better performance. If this still doesn't work i will create daily static HTML Pages containing the PMStats output.

BTW my Board at http://www.amihotornot.de has 30000 Users with 270000 stored messages.

If someone is interested in the fast version of this hack, please let me know.

sneak

ldydvr
Thu 5th Jul '01, 8:47am
Always, you bet!

Anytime someone can increase performance and better something I'm all ears (and fingers and eyes)!

=-)

ibeblunt
Thu 5th Jul '01, 11:29am
I would be.

My site has over 60,000 users with 414680 posts. It's crazy these days.

Steven

JackG
Wed 11th Jul '01, 1:07am
Total PM's in database 2331

Users with at least one PM 441

Users PM average ~5

------------------------
Above is my stats. question, are these based on 'un read' messages?

Any chance of a search option ?

The_Sisko
Wed 11th Jul '01, 11:38am
I know, there are many querys but I couldn't think of it to make it better at this time. I'm getting better and better maybe I should try to remake it, but the problem is to get all PM of a user in a group....I 'll take a look at it.

I have:
~1100 Members
~80000 post
~2000 PM's

so it works. I'am on my own server (PIII 800, 128MB..)

JackG
Wed 11th Jul '01, 11:40am
Good job on it The_Sisko, if you have time, you may want to add some features. It's a quality usefull hack.

ShadowTech
Wed 25th Jul '01, 9:38pm
I am now getting an error after having to swap databases the forum was running on.
<<
Warning: Division by zero in c:\inetpub\wwwroot\vB\admin\pmstats.php on line 59
>>

I read higher that you said it's because there are no posts.. which I don't see that as the problem considering the pmstats.php file is listing the total PMs under that error as :
Total PM's in database 5440
Users with at least one PM 300
Users PM average ~18

I don't know what is causing this.. I redownloaded the pmstats file from this thread and reuploaded it trying to fix it.. but it still gets the error.. worked perfectly before the DB swap.

Sinclair
Thu 26th Jul '01, 7:34pm
Originally posted by The_Sisko
...
I have:
~80000 post
...

90000 Posts! ;)

Sinclair