PDA

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


PaulSonny
31 Mar 2008, 22:17
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 (http://www.vbulletin.org/forum/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
31 Mar 2008, 22:20
Thanks for this Paul! Will install now!

Quick question: Does it hard delete them?

Regards Jason :)

Boofo
31 Mar 2008, 22:20
Is there any way to add a setting for how many days?

PaulSonny
31 Mar 2008, 22:26
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
31 Mar 2008, 22:35
I think what Boofo means is set it to their own choice of days. For example; 20 days.

And thanks Paul.

Regards Jason :)

PaulSonny
31 Mar 2008, 22:42
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
31 Mar 2008, 22:44
Paul,

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

Regards Jason :)

PaulSonny
31 Mar 2008, 22:46
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
31 Mar 2008, 23:14
That's great Paul! Will do some testing, and report any bugs I may find.

Regards Jason :)

Boofo
31 Mar 2008, 23:55
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
01 Apr 2008, 00:06
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
01 Apr 2008, 00:08
I will do that, sir. ;)

Jase2
01 Apr 2008, 00:23
adafsfs

PaulSonny
01 Apr 2008, 00:28
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
01 Apr 2008, 00:30
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
01 Apr 2008, 00:51
Nope you need this:

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

Jase2
01 Apr 2008, 00:57
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
01 Apr 2008, 01:16
$vbulletin->db->query_write('DELETE FROM ".TABLE_PREFIX."visitormessage');

My bad.

PaulSonny
01 Apr 2008, 01:25
$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
01 Apr 2008, 01:25
That produces the following:

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

Try that for me please.

Thanks, Paul.

Jase2
01 Apr 2008, 01:35
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
01 Apr 2008, 01:39
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "visitormessage");

Been given help with this one so hopefully should work.

Thanks, Paul.

Boofo
01 Apr 2008, 01:45
Shouldn't there be a * in there?

PaulSonny
01 Apr 2008, 01:47
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
01 Apr 2008, 06:41
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
01 Apr 2008, 07:43
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
01 Apr 2008, 09:34
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
01 Apr 2008, 14:45
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
01 Apr 2008, 14:53
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
01 Apr 2008, 17:47
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
31 May 2008, 11:35
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
31 May 2008, 12:17
Good suggestion, I will try and get it working for you.

Thanks, Paul.

BaziCenter
31 May 2008, 16:31
Good suggestion, I will try and get it working for you.

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

jerx
01 Jun 2008, 08:11
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
02 Jun 2008, 05:07
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
05 Jun 2008, 02:19
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
08 Jun 2008, 06:01
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 Jul 2008, 13:57
Installed!
Thanks !

TheInsaneManiac
07 Jul 2008, 15:38
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
16 Jul 2008, 04:00
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
16 Jul 2008, 05:04
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
18 Jul 2008, 16:55
Small issue, but it doesn't add the prefix.

sakli_duslerr
22 Aug 2008, 19:08
deleted but unread profile messages are still shown as unread.

?? problem

TheInsaneManiac
02 Oct 2008, 14:33
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
12 Jan 2009, 21:19
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
13 Jan 2009, 11:51
I will check this out and provide a solution.

Regards, Paul.

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

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

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

See the Periodic Prune Pms (http://www.vbulletin.org/forum/showthread.php?t=179879) add-on.

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

NTT
29 Jan 2009, 19:33
when you release for 3.8 vesion ? any idea . thanks

Dan Clement
04 May 2009, 01:15
I've also disabled it and will be running it manually every so often.

Thanks for your work. :)

TheInsaneManiac
10 May 2009, 07:08
I will check this out and provide a solution.

Regards, Paul.

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

LAJAURIA
21 May 2009, 01:52
deleted but unread profile messages are still shown as unread.

?? problem


I have the same problem.. :(


any solution??

TheInsaneManiac
25 May 2009, 17:41
I have the same problem.. :(


any solution??

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

Brandon Sheley
25 May 2009, 18:08
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
26 May 2009, 00:22
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
09 Jun 2009, 20:34
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
01 Sep 2009, 23:44
there is a problem :
if messages deleted before member see them >>> notification still appear on navbar

any solution?

Wifey
02 Aug 2010, 14:43
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
16 Jan 2011, 00:16
Can anyone do this for 4.0 or 4.1, 4.x I guess?

letsjoy
21 Dec 2011, 19:16
Can anyone do this for 4.0 or 4.1, 4.x I guess?

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