vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - PS - Delete All Visitor Messages Every 30 Days (https://vborg.vbsupport.ru/showthread.php?t=174737)

PaulSonny 03-30-2008 10:00 PM

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.

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

Quote:

Originally Posted by Jase2 (Post 1479448)
Thanks for this Paul! Will install now!

Quick question: Does it hard delete them?

Regards Jason :)

Yes Jason, this does hard delete them.

Quote:

Originally Posted by Boofo (Post 1479449)
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

Quote:

Originally Posted by Jase2 (Post 1479471)
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

Quote:

Originally Posted by Boofo (Post 1479521)
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

Quote:

Originally Posted by Jase2 (Post 1479540)
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...cron&cronid=25
Referrer : http://www.techsupportteam.org/forum....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:


Code:

$vbulletin->db->query_write("DELETE FROM visitormessage");
I believe I need to add my prefix at the beginning so it looks like this:


Code:

$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:

Quote:

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

Quote:

Originally Posted by hornstar1337 (Post 1479761)
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

Quote:

Originally Posted by hornstar1337 (Post 1479761)
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

Quote:

Originally Posted by PaulSonny (Post 1536967)
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

Quote:

Originally Posted by BaziCenter (Post 1536947)
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

Quote:

Originally Posted by jerx (Post 1537607)
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

Quote:

Originally Posted by BaziCenter (Post 1536947)
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

Quote:

Originally Posted by egerci (Post 1541155)
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

Quote:

Originally Posted by PaulSonny (Post 1479790)
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.


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
  • Page Generation 0.01308 seconds
  • Memory Usage 1,828KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete