PDA

View Full Version : Miscellaneous Hacks - PS - Delete All Visitor Messages Every 30 Days


PaulSonny
03-30-2008, 10:00 PM
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 (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=174737) 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.

Jase2
03-31-2008, 09:20 PM
Thanks for this Paul! Will install now!

Quick question: Does it hard delete them?

Regards Jason :)

Boofo
03-31-2008, 09:20 PM
Is there any way to add a setting for how many days?

PaulSonny
03-31-2008, 09:26 PM
Thanks for this Paul! Will install now!

Quick question: Does it hard delete them?

Regards Jason :)

Yes Jason, this does hard delete them.

Is there any way to add a setting for how many days?

Sorry Boofo I do not understand, a setting for how many days what? or do you mean like say from the 1st of january to 1st of february type thing?

Thanks, Paul.

Jase2
03-31-2008, 09:35 PM
I think what Boofo means is set it to their own choice of days. For example; 20 days.

And thanks Paul.

Regards Jason :)

PaulSonny
03-31-2008, 09:42 PM
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.

Jase2
03-31-2008, 09:44 PM
Paul,

As this is a scheduled task, I'll be able to disable it, then click "run now" whenever I wish?

Regards Jason :)

PaulSonny
03-31-2008, 09:46 PM
Paul,

As this is a scheduled task, I'll be able to disable it, then click "run now" whenever I wish?

Regards Jason :)

I believe so.

Thanks, Paul.

Jase2
03-31-2008, 10:14 PM
That's great Paul! Will do some testing, and report any bugs I may find.

Regards Jason :)

Boofo
03-31-2008, 10:55 PM
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. ;)

PaulSonny
03-31-2008, 11:06 PM
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. ;)

If you do manage to make a jack which will allow you to run the scheduled task every 180 days I would be eternally grateful if you would either help me improve this modification or show me the code you create?

Thanks, Paul.

Boofo
03-31-2008, 11:08 PM
I will do that, sir. ;)

Jase2
03-31-2008, 11:23 PM
adafsfs

PaulSonny
03-31-2008, 11:28 PM
Just been testing this Paul, and received the following error:

Database error in vBulletin 3.7.0 Release Candidate 1:

Invalid SQL:
DELETE FROM visitormessage;

MySQL Error : Table 'user_vbulletin.visitormessage' doesn't exist
Error Number : 1146
Date : Monday, March 31st 2008 @ 05:22:20 PM
Script : http://www.techsupportteam.org/forum/acp/cronadmin.php?do=runcron&cronid=25
Referrer : http://www.techsupportteam.org/forum/acp/cronadmin.php?do=modify
IP Address : 82.16.245.186
Username : Jason
Classname : vb_database
MySQL Version : 5.0.27-standard

It's saying it doesn't exist, when it quite clearly does. Any ideas?

Regards Jason :)

I think I know why, but to confirm my thoughts, do you use a Table Prefix?

Thanks, Paul.

Jase2
03-31-2008, 11:30 PM
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:


$vbulletin->db->query_write("DELETE FROM visitormessage");

I believe I need to add my prefix at the beginning so it looks like this:


$vbulletin->db->query_write("DELETE FROM prefix.visitormessage");

Correct?

Regards Jason :)

Boofo
03-31-2008, 11:51 PM
Nope you need this:

$vbulletin->db->query_write("DELETE FROM ".TABLE_PREFIX."visitormessage");

Jase2
03-31-2008, 11:57 PM
Did that! It now brings the following error:

Parse error: syntax error, unexpected T_STRING in /home/user/public_html/forum/includes/cron/visitormessagedelete.php on line 15

Regards Jason :)

Boofo
04-01-2008, 12:16 AM
$vbulletin->db->query_write('DELETE FROM ".TABLE_PREFIX."visitormessage');

My bad.

PaulSonny
04-01-2008, 12:25 AM
$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.

Jase2
04-01-2008, 12:25 AM
That produces the following:

PaulSonny
04-01-2008, 12:31 AM
$db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");

Try that for me please.

Thanks, Paul.

Jase2
04-01-2008, 12:35 AM
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 :)

PaulSonny
04-01-2008, 12:39 AM
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");

Been given help with this one so hopefully should work.

Thanks, Paul.

Boofo
04-01-2008, 12:45 AM
Shouldn't there be a * in there?

PaulSonny
04-01-2008, 12:47 AM
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.

Hornstar
04-01-2008, 05:41 AM
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.

PaulSonny
04-01-2008, 06:43 AM
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.

This was a special request for a user, but I suppose the underlying reason is to keep your database size down.

thanks, Paul.

christian8a
04-01-2008, 08:34 AM
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.

Yea, that would be probably the last thing my members would like me to do, imagine, they will all be pissed at me :erm:

Jase2
04-01-2008, 01:45 PM
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 :)

Jase2
04-01-2008, 01:53 PM
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 :)

Jase2
04-01-2008, 04:47 PM
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 :)

BaziCenter
05-31-2008, 10:35 AM
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!

PaulSonny
05-31-2008, 11:17 AM
Good suggestion, I will try and get it working for you.

Thanks, Paul.

BaziCenter
05-31-2008, 03:31 PM
Good suggestion, I will try and get it working for you.

Thanks, Paul.
Thanks for your reply and I appreciate your work.;)

jerx
06-01-2008, 07:11 AM
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!

I think this would make it more useful for other vb admins. But to make it even more appealing, here are some more suggestions.

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!

Julie
06-02-2008, 04:07 AM
I think this would make it more useful for other vb admins. But to make it even more appealing, here are some more suggestions.

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!

I second that :D

And the one about only deleting 30+ old messages, not the newnew ones :)

Thanks!

egerci
06-05-2008, 01:19 AM
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!

Hi,

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

;)

EvilJohn
06-08-2008, 05:01 AM
Hi,

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

;)

Thanks, and thank you Paul. Installed!

saviola8x
07-07-2008, 12:57 PM
Installed!
Thanks !

TheInsaneManiac
07-07-2008, 02:38 PM
This was a special request for a user, but I suppose the underlying reason is to keep your database size down.

thanks, Paul.
That and to save you loading time. I have like a hundred messages on my profile and it's slow! Thanks for this.

Also: Is there a way to make it so that certain members/usergroups do not get theirs deleted.

kylek
07-16-2008, 03:00 AM
Could this be changed in any way to just delete the soft deleted messages members have deleted but cant hard delete? We have an active board and tons of soft deleted messages weekly, a pain that they cant hard delete their own messages.

blind-eddie
07-16-2008, 04:04 AM
Could Enable & Disable check boxes be added to the edit options within the usercp? Allowing them the chose between enabling or disabling there Visitor Messages from being deleted? Or maybe within there profile? Just a thought.

Note: I did not download this mod yet, I was just inquiring about possible addons & to see how others experiences with this Mod goes before I download & install.

TheInsaneManiac
07-18-2008, 03:55 PM
Small issue, but it doesn't add the prefix.

sakli_duslerr
08-22-2008, 06:08 PM
deleted but unread profile messages are still shown as unread.

?? problem

TheInsaneManiac
10-02-2008, 01:33 PM
deleted but unread profile messages are still shown as unread.

?? problem
Same issue with me. It is fairly annoying to me and my members.

want3ed
01-12-2009, 08:19 PM
i use clear all visitor messages mod but some users have pending visitor message notifications , how i can clear my all users pending or not reading notifications.

PaulSonny
01-13-2009, 10:51 AM
I will check this out and provide a solution.

Regards, Paul.

djbaxter
01-15-2009, 12:41 AM
You also need to update table messageread (with the prefix).

NTT
01-27-2009, 02:44 AM
how abount Private Messages ? any Idea for this, I thing this will help for data and banwith .:)

djbaxter
01-27-2009, 03:07 AM
how abount Private Messages ? any Idea for this, I thing this will help for data and banwith .:)

See the Periodic Prune Pms (https://vborg.vbsupport.ru/showthread.php?t=179879) add-on.

NTT
01-29-2009, 12:40 AM
See the Periodic Prune Pms add-on. IS This vesion is work with 3.8 too Bro . Thank for the Mod

NTT
01-29-2009, 06:33 PM
when you release for 3.8 vesion ? any idea . thanks

Dan Clement
05-04-2009, 12:15 AM
I've also disabled it and will be running it manually every so often.

Thanks for your work. :)

TheInsaneManiac
05-10-2009, 06:08 AM
I will check this out and provide a solution.

Regards, Paul.

Still waiting man, it's been like four months.

LAJAURIA
05-21-2009, 12:52 AM
deleted but unread profile messages are still shown as unread.

?? problem


I have the same problem.. :(


any solution??

TheInsaneManiac
05-25-2009, 04:41 PM
I have the same problem.. :(


any solution??

Everyone has, he says he would provide a solution, but none has been provided.

Brandon Sheley
05-25-2009, 05:08 PM
Can I just ask, what are the benefits of deleting these messages?
I know some members chat back and forth via the profile comments

cheers

djbaxter
05-25-2009, 11:22 PM
Can I just ask, what are the benefits of deleting these messages? I know some members chat back and forth via the profile comments

What are the benefits of HAVING these messages in the first place?

Cons: They potentially take away activity from the forum, add something else to be monitored for potential abuse, and take up space in the database.

Pros: ???

TheInsaneManiac
06-09-2009, 07:34 PM
Thanks to some staff on VBulletin I got a query that will reset the count after deletion. I then implemented it into the current code.

Find in visitormessagedelete.php:
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");

Add Below:
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "user SET vmunreadcount = '0'");

abdobasha2004
09-01-2009, 10:44 PM
there is a problem :
if messages deleted before member see them >>> notification still appear on navbar

any solution?

Wifey
08-02-2010, 01:43 PM
there is a problem :
if messages deleted before member see them >>> notification still appear on navbar

any solution?

Curious about the fix for this as well...

top dogs 360
01-15-2011, 11:16 PM
Can anyone do this for 4.0 or 4.1, 4.x I guess?

letsjoy
12-21-2011, 07:16 PM
Can anyone do this for 4.0 or 4.1, 4.x I guess?

This is mod very critical for big forums... :(