Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Prune Private Messages - Age Based Details »»
Prune Private Messages - Age Based
Version: 1.00, by djbaxter djbaxter is offline
Developer Last Online: Aug 2021 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.x Rating:
Released: 03-16-2007 Last Update: Never Installs: 25
Additional Files  
No support by the author.

I recommend that anyone interested in this add-on install Periodic Prune PMs instead.

WORKAROUND:I have been unable to find the time to update this or to fix the incorrect counts problem. For those having this issue, use one of the "Send PM to all members" add-ons and send a message similar to the following:

Quote:
To update PM counts to the correct value, simply delete this message. vBulletin will automatically then reset your PM count correctly.
I've also just discovered this new add-on for vBulletin 3.7x: Periodic Prune Pms [Cron Job - Fully Controllable].


WARNING: I have discovered that, at present, the individual PM counts (user.pmtotal and user.pmunread) are not updated by this script and therefore running the script will leave members with inaccurate PM counts. I am currently seeking a way to fix this.


This add-on prunes old private messages based on age, and cleans up message receipts.

The add-on was adapted for vBulletin 3.6x from amykhar's Mass Delete Old Private Messages for vBulletin 2.2x (see https://vborg.vbsupport.ru/showthread.php?t=27421).

Thanks to Jacqueline at the http://www.vbulletin.org forum, and Sarah and Jorrit787 at the http://www.theadminzone.com forum for assistance with the MySQL queries.

This is designed to run as a cron job.

Upload to your ./includes/cron/ folder. Then set up a new scheduled task as Prune PMs with your preferences as to frequency.

The attached prunepms.php file deletes PMs after 60 days:

PHP Code:
$time time() - (60 24 60 60); 

 print (
"Pruning old private messages... <br/>");
 
$query "DELETE " TABLE_PREFIX "pmtext . * , " TABLE_PREFIX "pm . * FROM " TABLE_PREFIX "pmtext, " TABLE_PREFIX "pm  WHERE " TABLE_PREFIX "pm.pmtextid = " TABLE_PREFIX "pmtext.pmtextid AND " TABLE_PREFIX "pmtext.dateline < $time";
 
mysql_query($query);

 print(
"Records deleted: ");
 print (
mysql_affected_rows());
 print (
"<br/>"); 
It also deletes ALL PM receipts separately (this is because trying to delete receipts linked to the age-based PMs resulted in PMs without receipts being ignored for deletion):

PHP Code:
 print ("Pruning private message receipts... <br/>");
 
$query "DELETE " TABLE_PREFIX "pmreceipt . * FROM " TABLE_PREFIX "pmreceipt WHERE " TABLE_PREFIX "pmreceipt.pmid > 0";
 
mysql_query($query);

 print(
"Records deleted: ");
 print (
mysql_affected_rows());
 print (
"<br/>"); 
Feel free to personalize these settings for your own requirements.

I'll support this add-on to the extent that I can but be aware I am not expert at either PHP or MySQL.

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 06-01-2007, 01:19 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by PossumX View Post
I am guessing that this has "died on the vine"
No, not quite. I just haven't been able to move it back to the top of my priority list yet. But I haven't given up on it.

As stated above, though, if anyone with more time would like to have a look at it, I'd welcome the assistance. I have two versions - the published one which works with some limitations, and a subsequent version which gives me MySQL errors.
Reply With Quote
  #33  
Old 08-10-2007, 04:01 PM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by coinwash View Post
No one to pick this ball up?

Does anyone have a better way??

Thanks
Looks like the coder is updating the code for this per his message in green up top of the hack:

Quote:
WARNING: I have discovered that, at present, the individual PM counts (user.pmtotal and user.pmunread) are not updated by this script and therefore running the script will leave members with inaccurate PM counts. I am currently seeking a way to fix this.


In another words if he supports it, I think he'll fix what you are reporting....
Reply With Quote
  #34  
Old 08-10-2007, 04:11 PM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by coinwash View Post
I have tryed this hack and it's not working.
I'm getting

PHP Fatal error: Call to a member function on a non-object in /chroot/home/coinwash/coinwash.com/html/mb/killpms.php on line 6

Is there anyone out there who knows the Fix---Please

Thank you
Sorry for the double post, on this hack how come you are referencing a killpms.php when the hack's file name is only prunepms.php and shouldn't have nothing to do with a "killpms.php" Because only one file is for download here which is prunepms.php...

PHP Code:
<?php 
// ######################################################################
// # Prune Private Messages (based on age) version 1.0                  #
// # by djbaxter http://forum.psychlinks.ca March 2007                  #
// #                                                                    #
// # Adapted for vBulletin 3.6x (tested on vBulletin 3.65)              #
// # from amykhar's Mass Delete Old Private Messages for vBulletin 2.2x #
// # (see https://vborg.vbsupport.ru/showthread.php?t=27421)        #
// #                                                                    #
// # Thanks to Jacqueline at the http://www.vbulletin.org forum,        #
// # and Sarah and Jorrit787 at the http://www.theadminzone.com forum   #
// # for assistance with the MySQL queries                              #
// ######################################################################

error_reporting(E_ALL & ~E_NOTICE);

define("THIS_SCRIPT""Prune Private Messages");

$time time() - (60 24 60 60); 

 print (
"Pruning old private messages... <br/>");
 
$query "DELETE " TABLE_PREFIX "pmtext . * , " TABLE_PREFIX "pm . * FROM " TABLE_PREFIX "pmtext, " TABLE_PREFIX "pm  WHERE " TABLE_PREFIX "pm.pmtextid = " TABLE_PREFIX "pmtext.pmtextid AND " TABLE_PREFIX "pmtext.dateline < $time";
 
mysql_query($query);

 print(
"Records deleted: ");
 print (
mysql_affected_rows());
 print (
"<br/>");

 print (
"Pruning private message receipts... <br/>");
 
$query "DELETE " TABLE_PREFIX "pmreceipt . * FROM " TABLE_PREFIX "pmreceipt WHERE " TABLE_PREFIX "pmreceipt.pmid > 0";
 
mysql_query($query);

 print(
"Records deleted: ");
 print (
mysql_affected_rows());
 print (
"<br/>");
 
?>
Reply With Quote
  #35  
Old 09-07-2007, 05:57 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by coinwash View Post
Still not working?

Is this hack working for anyone???

Prune Private Messages
It works (to a degree). It's just not complete.

It will:

1. prune private messages over a certain age if run manually, which you can do from the ACP

It won't:

1. run successfully as a cron job/scheduled task, or at least it doesn't work for all configurations

2. correctly recount stored PMs for members after delteing old PMs

I apologize. I've had a series of issues - medical issues, then a death in the family, then surgery with home recovery and complications. It's still on my to-do list. I just haven't been able to get to it yet.

If anyone would like to take this and make it work the way it should, please feel free. Alternatively, feel free to make suggestions on altering the code.
Reply With Quote
  #36  
Old 11-18-2007, 01:32 AM
PoetJA-1975's Avatar
PoetJA-1975 PoetJA-1975 is offline
 
Join Date: Sep 2006
Location: Meh...
Posts: 1,218
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
WARNING: I have discovered that, at present, the individual PM counts (user.pmtotal and user.pmunread) are not updated by this script and therefore running the script will leave members with inaccurate PM counts. I am currently seeking a way to fix this.

WORKAROUND: Update the counts from your Admin CP, especially thread and post counts. This seems to fix the PM counts as well.
Does this workaround work correctly and leave Members with accurate PM counts?
Thanx,

Jacquii.
Reply With Quote
  #37  
Old 11-18-2007, 01:47 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by PoetJA-1975 View Post
Does this workaround work correctly and leave Members with accurate PM counts?
Thanx,

Jacquii.
Unfortunately, no.

The first time a member manually deletes a PM, the count is correctly updated. I haven't yet found a way to do it successfully from the Admin CP.

I try to work on a new version periodically as I get time but between work, family, and 4 and a half months recovering from three bouts of surgery this year I haven't yet got to a version which doesn't create some errors.

What's required is that the script correctly updates three variables: one for the PM, one for the PM text, and one for the count decrement.

I have said more than once that if there's anyone out there with more time to devote to the issue, I'll willingly turn over all credit and the current versions I have so far to them.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05909 seconds
  • Memory Usage 2,305KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete