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
  #12  
Old 03-18-2007, 06:39 PM
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Posts: 4,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*Edit NVM
Im working on it now..
Reply With Quote
  #13  
Old 03-18-2007, 07:15 PM
hal05 hal05 is offline
 
Join Date: Aug 2005
Location: Mid-Michigan
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Worked great, installed!
Reply With Quote
  #14  
Old 03-19-2007, 12:29 PM
NFLfbJunkie NFLfbJunkie is offline
 
Join Date: Sep 2006
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this MOD delete any private messages that are saved in created pm folders?
Reply With Quote
  #15  
Old 03-19-2007, 12:39 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not 100% certain but, unless they are stored in the database somewhere other than the pm and pmtext tables, the answer is probably yes.
Reply With Quote
  #16  
Old 03-19-2007, 01:45 PM
Endurer Endurer is offline
 
Join Date: Sep 2006
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool! Digitalpoint forums have this on their board and I would love to have it.
Reply With Quote
  #17  
Old 03-21-2007, 05:52 AM
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Posts: 4,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Schdule task time for some reason never wants to update this
have to always click *Run now*
Tested on 2 sites and not working

[high]* Shazz uninstalls[/high]
Reply With Quote
  #18  
Old 03-21-2007, 11:33 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How did you determine it's not running? Please note it's not writing to a log file.
Reply With Quote
  #19  
Old 03-21-2007, 01:10 PM
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Posts: 4,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djbaxter View Post
How did you determine it's not running? Please note it's not writing to a log file.
Its easily to tell by how schedule task time dosen't update automatically.
Reply With Quote
  #20  
Old 03-21-2007, 01:24 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm.... okay. You can still run it manually for now - we're working on a new version of this, in any case.
Reply With Quote
  #21  
Old 03-21-2007, 11:44 PM
PossumX's Avatar
PossumX PossumX is offline
 
Join Date: Oct 2006
Location: NE USA
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would you consider adding an option to exclude certain usergroups, by ID #? This would allow the Admin and Moderators (and others if chosen) to be immune from the pruning activity, which is appropriate on many forums, and would be worth the control level, in my opinion.
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 07:50 AM.


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.04940 seconds
  • Memory Usage 2,316KB
  • Queries Executed 26 (?)
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
  • (2)bbcode_php
  • (2)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
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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