![]() |
PS - Delete All Visitor Messages Every 30 Days
vBulletin 3.7 Version This is my third modification. Any questions asked by members who have not marked this as installed will be considered low priority. About This Hack: This has been requested from a vBulletin.org member. This will delete all Visitor Messages every 30 days. (1st of Every Month) Installation Information: 1 Additional File, 1 Scheduled Task. To install just unzip the download below and import into vB using the ACP Product Manager, further and full instructions are included. If you wish to make the Scheduled Task run more often you can edit the Scheduled Task. Go to Admin CP >> Scheduled Tasks >> Scheduled Task Manager >> Visitor Message Del >> Then Edit To Your Choice, for example if you choose Day of Week as Sunday, this will run every Sunday. Please post your comments or suggestions for this hack. I read ALL posts. Please remember to click Mark As Installed if you use this modification. If you use this plug-in, and find it useful, please support us by nominating us for Mod Of The Month (MOTM) in the top right corner of this thread, or feel free to donate. You will get an email when a new version is released. History: Version 1.00: Initial version for vBulletin 3.7. |
Thanks for this Paul! Will install now!
Quick question: Does it hard delete them? Regards Jason :) |
Is there any way to add a setting for how many days?
|
Quote:
Quote:
Thanks, Paul. |
I think what Boofo means is set it to their own choice of days. For example; 20 days.
And thanks Paul. Regards Jason :) |
I'm afraid the only way I know how to do that at the minute is by manually going in and editing the Scheduled Task.
Go to Admin CP >> Scheduled Tasks >> Scheduled Task Manager >> Visitor Message Del >> Then Edit To Your Choice, for example if you choose Day of Week as Sunday, this will run every Sunday. Thanks, Paul. |
Paul,
As this is a scheduled task, I'll be able to disable it, then click "run now" whenever I wish? Regards Jason :) |
Quote:
Thanks, Paul. |
That's great Paul! Will do some testing, and report any bugs I may find.
Regards Jason :) |
I was thinking more like a setting so you could run it at 180 days if you wanted to.
But, no biggie, I'll make a hack to do a setting for me. Good job, though. ;) |
Quote:
Thanks, Paul. |
I will do that, sir. ;)
|
adafsfs
|
Quote:
Thanks, Paul. |
Yes, I do. :)
I thought that may be the problem too. I'll need to edit it right, and include my table prefix? Which code would I edit? But there again, it's added my table prefix above -- it's just saying it can find it. EDIT: I see this in the .php file: Code:
$vbulletin->db->query_write("DELETE FROM visitormessage"); Code:
$vbulletin->db->query_write("DELETE FROM prefix.visitormessage"); Regards Jason :) |
Nope you need this:
$vbulletin->db->query_write("DELETE FROM ".TABLE_PREFIX."visitormessage"); |
Did that! It now brings the following error:
Quote:
|
$vbulletin->db->query_write('DELETE FROM ".TABLE_PREFIX."visitormessage');
My bad. |
$vbulletin->db->query_write('DELETE FROM ".TABLE_PREFIX."visitormessage');
Yeah this should work, sorry about the table_prefix error, with me not using a table prefix myself I forgot. Thanks, Paul. |
That produces the following:
|
$db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");
Try that for me please. Thanks, Paul. |
Another error:
Fatal error: Call to a member function on a non-object in /home/user/public_html/forum/includes/cron/visitormessagedelete.php on line 15 Regards Jason :) |
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");
Been given help with this one so hopefully should work. Thanks, Paul. |
Shouldn't there be a * in there?
|
I thought the same, but according to this SQL article i'm reading apparently not, but it wouldnt hurt to try and put one in.
Thanks, Paul. |
I have not started to use vb 3.7 just yet, however looking at some good hacks to install for when I do. Just wondering if there is an underlying reason that one would want to use this hack.
Thanks. |
Quote:
thanks, Paul. |
Quote:
|
Think of the space you could free...
I'm going to be disabling it, then running it every so often. I'll always let me members know, however. This just makes it easier for you just to click and boom -- all vm's are gone! Regards Jason :) |
Paul, I got it working -- I used the following:
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage"); Sorry for the confusion, it was very late last night :p Regards Jason :) |
Just to let users know:
This is a cron job, you can disable it if you wish, then just click "Run Now" whenever you want and boom all visitor messages are gone! Regards Jason :) |
I think it's better that this hack only delete the mesasges which has been posted 30 days ago or more. not to delete all of the messages every 30 days.
thanks for this hack anyway! |
Good suggestion, I will try and get it working for you.
Thanks, Paul. |
Quote:
|
Quote:
1. Visitor messages limit, if possible different settings for each user group. 2. Exclude certain user groups to make it more attractive to subscribe for paid subscriptions or to join the moderator team. Thank you! |
Quote:
And the one about only deleting 30+ old messages, not the newnew ones :) Thanks! |
Quote:
Open visitormessagedelete.php file and find : $vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage"); replace with: $vbulletin->db->query_write("DELETE FROM ".TABLE_PREFIX."visitormessage where FROM_UNIXTIME(dateline )<SUBDATE(CURDATE(), INTERVAL 30 DAY )"); it will work. You can change 30 DAY with whatever you want. You can also change cron job to run this script every day ;) |
Quote:
|
Installed!
Thanks ! |
Quote:
Also: Is there a way to make it so that certain members/usergroups do not get theirs deleted. |
All times are GMT. The time now is 02:13 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|