PDA

View Full Version : Prune PMs older than 30 days


GenSec
10-13-2004, 10:00 PM
These hack adds a cron job to prune old PMs for vBulletin 3.

======================
Upload the attached .php file
======================

includes/cron directory
cleanoldpm.php

========================
Make a vB-Cron entry
========================

Go to admin controlpanel

1) Scheduled Tasks
2) Add New Scheduled Task with the following data

Titel: Prune PMs older 30 days
weekday: *
day of month: *
hour: 0
minute: 0
enable log: no
filename: ./includes/cron/cleanoldpm.php


Thats all.

Polo
10-14-2004, 05:14 PM
mmm.. this hack may come in handy ;) thanks GenSec for sharing ;)

frankenberrie
10-15-2004, 07:24 PM
This hack will be great for the Arcade mod - Most members never delete their old challenge pms-

dssstorm
10-28-2004, 11:43 PM
He rock's

paulyy
11-21-2004, 12:41 AM
Nice hack :)

alkahf
11-26-2004, 03:30 PM
Hello GenSec
Before install hack
Private Messages: 2 Unread, Total 280.
After installed hack:
The same numbers: Private Messages: 2 Unread, Total 280.
But I have now only 5 PMs:).
How fix it ?

akahf

GenSec
11-27-2004, 02:55 PM
Run the cron job :)

alkahf
11-28-2004, 05:21 AM
Run the cron job :)
I run it.
It is deleted PMs but the PM numbers count in Nav Bar not change :)!!
Do you see?:)

Regards

Vman
11-28-2004, 05:41 AM
This is great!.......Can't wait for more cron jobs to become available for download...

Thanks!

allhandl
12-01-2004, 11:19 PM
if I PM a user and they dont logon on within the 30 days the PM is wiped off the server as the hack states. However when they logon the navbar states they have a message. When you go to inbox it says it is empty.

Whats worse is there is no way to delete it out of there?

Im a newbie but it almost looks like the PM is getting deleted however the 'messageread' table in db isnt being effected. This only happens when a user does not view the message within the 30 days. If I read a PM and leave in inbox it deletes with no problems.

Anyone having similar problem or has a solution?

TTG
12-02-2004, 10:03 AM
Very useful .. thanks for the hack.
Clicked install

wowthatnice
12-11-2004, 09:24 AM
I run it.
It is deleted PMs but the PM numbers count in Nav Bar not change :)!!
Do you see?:)

Regards

Do this, open cleanoldpm.php find
$DB_site->free_result($oldpms);
below add
// update the pm counters for $bbuserinfo. Uha 12/10/2004
$bbuserinfo = $DB_site->query_first("
SELECT userid, pmtotal, pmunread
FROM " . TABLE_PREFIX . "user
");

$bbuserinfo['userid'] = intval($bbuserinfo['userid']);
$bbuserinfo['pmtotal'] = intval($bbuserinfo['pmtotal']);
$bbuserinfo['pmunread'] = intval($bbuserinfo['pmunread']);

$pmcount = $DB_site->query_first("
SELECT
COUNT(pmid) AS pmtotal,
SUM(IF(messageread = 0 AND folderid = 0, 1, 0)) AS pmunread
FROM " . TABLE_PREFIX . "pm AS pm
WHERE pm.userid = $bbuserinfo[userid]
");

$pmcount['pmtotal'] = intval($pmcount['pmtotal']);
$pmcount['pmunread'] = intval($pmcount['pmunread']);

if ($bbuserinfo['pmtotal'] != $pmcount['pmtotal'] OR $bbuserinfo['pmunread'] != $pmcount['pmunread'])
{
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user SET
pmtotal = $pmcount[pmtotal],
pmunread = $pmcount[pmunread]
WHERE userid = $bbuserinfo[userid]
");
}

$DB_site->free_result($bbuserinfo);
$DB_site->free_result($pmcount);

My friend just fix that for me.

Have fun.

alkahf
12-11-2004, 03:39 PM
Thankyou wowthatnice
I'll try this change.

Regards:)

alkahf
12-12-2004, 03:25 AM
The same problem,
Not change PM's counters.
Is it working with you wowthatnice ?

wowthatnice
12-12-2004, 04:36 AM
Yeah, I been test it out and it work great without any error. But what do you get? it not update at all? Let me ask him again becuase when I ask him he only take around 3 minutes to make it for me and he didn't even test it.

T3MEDIA
12-13-2004, 08:37 AM
Please let us know. I would like to install this as well.

trackpads
12-13-2004, 11:20 PM
Great work!! Thanks!!

T3MEDIA
12-21-2004, 11:12 AM
Please let us know. I would like to install this as well.
::bump:: polite.

trackpads
12-22-2004, 05:13 PM
::bump:: polite.
Any have any idea how to change it from 30 days? I want them pruned after 180 days for example.

thanks again,

-Jason

GenSec
12-23-2004, 05:24 AM
Any have any idea how to change it from 30 days? I want them pruned after 180 days for example.

thanks again,

-Jason
In cleanoldpm.php change
WHERE pmtext.dateline < " . (TIMENOW - 2592000) . "

to

WHERE pmtext.dateline < " . (TIMENOW - 15552000) . "

T3MEDIA
12-23-2004, 12:30 PM
hummm. ok.

T3MEDIA
12-23-2004, 12:39 PM
Why this does not keep a log? I see G. was here but doesnt reply. I was intrested in this whole heartly.

No thanks.

Happy holidays.

trackpads
12-23-2004, 01:48 PM
In cleanoldpm.php change
WHERE pmtext.dateline < " . (TIMENOW - 2592000) . "

to

WHERE pmtext.dateline < " . (TIMENOW - 15552000) . "
THANKS!

cinq
12-23-2004, 02:53 PM
have the problems for this hack been fixed ?
Would be a great addition ( in fact should come standard in vb ) :D

Vman
01-11-2005, 05:01 AM
I have installed this a few months ago...And I have yet to see the cron job do its job! yet I get no errors on this...Why...

i.e.:
I have had 157 PM's and I still have 157 PM's after a month and 1/2...the cron did not work...

Vman
01-15-2005, 06:03 AM
OK, Is there a way to change the 30 days to 15 days and how?

MrD
01-15-2005, 03:14 PM
Hi,
OK, Is there a way to change the 30 days to 15 days and how?

https://vborg.vbsupport.ru/showpost.php?p=585314&postcount=20

in this post, the User change the Time to 180 days

U must be change the timenow variable to your time :)

Vman
01-15-2005, 05:13 PM
Thank You!!!!

+Fares+
02-07-2005, 03:30 PM
Hello GenSec
Before install hack
Private Messages: 2 Unread, Total 280.
After installed hack:
The same numbers: Private Messages: 2 Unread, Total 280.
But I have now only 5 PMs:).
How fix it ?

akahf
Before install hack
Private Messages: 0 Unread, Total 916.
After installed hack:
The same numbers: Private Messages: 0 Unread, Total 916.
But I have now only 573 PMs:).
How fix it ?

MAK-upl
02-18-2005, 02:25 PM
306 - clicks install

Rabbitoh Warren
04-16-2006, 03:36 PM
If there is an equivalant mod like this for vB 3.5 someone please point me in the right direction.

Thanks.

DjJoschimo
04-16-2006, 06:31 PM
yes, please me too :) ;)

jluerken
08-09-2006, 01:59 PM
I am searching for such a sheduled task for vBulletin 3.6

Will this work?

Alphawolf83
05-20-2007, 06:35 PM
Any equivalant Hack for 3.6 existing? :)

Shazz
05-20-2007, 07:12 PM
Any equivalant Hack for 3.6 existing? :)

Simular was released but the cron didn't work as ususal...