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
  #22  
Old 03-22-2007, 12:59 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
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.
Sounds like a good idea, if I can figure out how to do that.

If anyone would like to have input on this or any other issue, I will happily acknowledge and share credit.
Reply With Quote
  #23  
Old 03-22-2007, 06:25 AM
a1whs.com a1whs.com is offline
 
Join Date: Feb 2006
Location: Canada of Course
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djbaxter View Post
Sounds like a good idea, if I can figure out how to do that.

If anyone would like to have input on this or any other issue, I will happily acknowledge and share credit.
U will figure it out baxter like always. Waiting for that option before i put this on my forums
Reply With Quote
  #24  
Old 04-04-2007, 02:30 AM
PossumX's Avatar
PossumX PossumX is offline
 
Join Date: Oct 2006
Location: NE USA
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any updates on this mod? Looking forward to it, but need the ability to exclude Admins and Mods (and any other group # needed).
Reply With Quote
  #25  
Old 04-04-2007, 02:47 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm working on it. My kids and my day job keep getting in the way.
Reply With Quote
  #26  
Old 04-09-2007, 07:23 PM
PossumX's Avatar
PossumX PossumX is offline
 
Join Date: Oct 2006
Location: NE USA
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djbaxter View Post
I'm working on it. My kids and my day job keep getting in the way.
Boy, do I hear that. Story of my life.
Reply With Quote
  #27  
Old 04-09-2007, 08:54 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
I'm working on it. My kids and my day job keep getting in the way.
Take your time...
I have a tweak for the private messages not displaying right. but cron still dosen't run right
Reply With Quote
  #28  
Old 04-09-2007, 10:54 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My current version has a MySQL error...

Shazz, would you care to collaborate?
Reply With Quote
  #29  
Old 04-14-2007, 01:52 AM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for a great hack, hell and I was thinking of coming up with something like this, but you took the cake with this one!

Should I use the search function in here?

All the best!
Reply With Quote
  #30  
Old 04-14-2007, 02:04 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you can help to debug it, I'd welcome all help.

I'll PM the latest buggy version to anyone who can help with debugging. I've been swamped with more pressing projects these last few weeks,
Reply With Quote
  #31  
Old 05-31-2007, 11:17 PM
PossumX's Avatar
PossumX PossumX is offline
 
Join Date: Oct 2006
Location: NE USA
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am guessing that this has "died on the vine"
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:55 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.10214 seconds
  • Memory Usage 2,325KB
  • 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
  • (5)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