View Full Version : Purge "number" of warnings?
beano33
12-08-2005, 01:19 PM
Is there a way to set up a task to completely remove warnings after a set period? (eg 6 mos). I'm using "Maintain Historical Records", but I don't want the warning number to remain with a user forever since that's also used to ban. I tried prune warnings after 180 days, but that didn't change the warning number.
If that's not practical, a query that would set everyone's number of warnings to 0 will do.
Thanks
sv1cec
12-11-2005, 05:58 AM
It's not as simple as you think. A cron script has to be written, which will check each of your warned members and then it will check the dates of their warnings. For each warning that is older than a predefined time period, it will subtract 1 from the number of warnings of that member.
Here is a script I made up quickly, which should do that for you. I haven't tested it, but it should work.
It's using the Alerts life time (How long will your Alerts stay in a users account?) as a cut-off limit. For any warnings it finds, issued before that time limit, it reduces the number of warnings the user has by one.
You can change the script so that it works based not on the issue date, but on the date the warning has matured and was rendered inactive (I believe this is the proper way to do it). You will find comments in that part of the script, basically you uncomment a line, and comment the line below it.
You can run that script manually or you can add it in your Scheduled Tasks to run once a day.
Let me know if it works.
beano33
12-12-2005, 04:07 PM
It's not as simple as you think. A cron script has to be written, which will check each of your warned members and then it will check the dates of their warnings. For each warning that is older than a predefined time period, it will subtract 1 from the number of warnings of that member.
Here is a script I made up quickly, which should do that for you. I haven't tested it, but it should work.
It's using the Alerts life time (How long will your Alerts stay in a users account?) as a cut-off limit. For any warnings it finds, issued before that time limit, it reduces the number of warnings the user has by one.
You can change the script so that it works based not on the issue date, but on the date the warning has matured and was rendered inactive (I believe this is the proper way to do it). You will find comments in that part of the script, basically you uncomment a line, and comment the line below it.
You can run that script manually or you can add it in your Scheduled Tasks to run once a day.
Let me know if it works.
I ran the script trying for the first option - "reduce the warnings of a member for those warnings which had MATURED xx days before today", and no warnings were removed.
I changed the comment outs as shown here-
// UNCOMMENT ONLY ONE OF THE LINES BELOW.
$date=$warn['removed_date']+$vboptions['warn_alertslifetime']*24*60*60;
//$date=$warn['warned_time']+$vboptions['warn_alertslifetime']*24*60*60;
My alerts have a 5 day expiration time. Does that need to be entered somewhere? Thanks!
sv1cec
12-12-2005, 04:14 PM
No, if it's been entered in your AWS Options. Have you set it up there?
Did the script worked when you changed the commented line or not?
beano33
12-12-2005, 04:47 PM
No, if it's been entered in your AWS Options. Have you set it up there?
Did the script worked when you changed the commented line or not?
Alerts are set up in AWS Options (great feature BTW). It's not working with the line commenting done as I posted.
sv1cec
12-12-2005, 05:26 PM
So the script does not work, in either form, right? Hmm, let me check that out again.
One question, you are using the Historical records, right? So there are active and inactive warnings in your log. The script is trying to find inactive warnings (i.e. warnings which have matured). It then removes 1 from the member's warnings number. It does not remove the warnings themselves. Did you check if the warnings number of the members are reduced?
Do you also want the script to remove those warnings from your database?
beano33
12-12-2005, 06:10 PM
So the script does not work, in either form, right? Hmm, let me check that out again.
One question, you are using the Historical records, right? So there are active and inactive warnings in your log. The script is trying to find inactive warnings (i.e. warnings which have matured). It then removes 1 from the member's warnings number. It does not remove the warnings themselves. Did you check if the warnings number of the members are reduced?
Do you also want the script to remove those warnings from your database?
I have historical warnings off now, but the old warning number still shows for the users. I'm trying to get that so it's the same as the number of unexpired warnings, or alternatively just reset everyone's warning number to zero so we can start fresh with warning number as a ban critera. The warning number hasn't been reduced for any of the members I checked, even though the expired ones no longer show.
sv1cec
12-12-2005, 06:49 PM
We are not getting anywhere like that. Of course and the script will not work with no historical data in your database. The program checks to find Inactive warnings, i.e. warnings which have matured and are marked as Inactive. If it does not find any, it will not reduce the number of warnings a member has.
Initially you told me you had Historical on, now you say you turned it off. I can't change the script every day, just because you change your criteria. Sorry.
beano33
12-12-2005, 07:16 PM
We are not getting anywhere like that. Of course and the script will not work with no historical data in your database. The program checks to find Inactive warnings, i.e. warnings which have matured and are marked as Inactive. If it does not find any, it will not reduce the number of warnings a member has.
Initially you told me you had Historical on, now you say you turned it off. I can't change the script every day, just because you change your criteria. Sorry.
I changed it because no one responded to my post for 2-3 days. I realize your time is limited, as is mine, but this absolutely had to be dealt with as I was getting dozens of complaints. I ended up removing it from the template to calm the angry masses, but I'd still like make it functional. I assumed from the AWS menu text that the warnings would be removed by turning off historical warnings so that was a logical step to take.
Maintain Historical Records?If set to No, warnings and bans which expire or are removed, will be deleted and will not show in the user's account. If set to Yes, these records will be kept in the database, but be marked as Inactive.
sv1cec
12-12-2005, 07:39 PM
Yes, the warnings are removed, and do not show. But how many warnings a user has received is not removed, because the management team wants to know how good a user is. If you do not use historical, you do not see the warnings a member has received, but you still know that that particular user has been warned x times. If you want that removed, just run the following query, it will set all your user warnings to zero
update user set warnings=0
add the table prefix in front of the table name (user) if you are using one. That will reset all your user warnings to zero.
beano33
12-13-2005, 12:20 AM
Thanks John, that's what I needed. I won't cause you anymore trouble until I update to 3.5.x :D. Happy Holidays!
sv1cec
12-13-2005, 03:57 AM
Well, if you do upgrade to 3.5 then you will not cause any more troubles, since I DO NOT support the 3.5 version, Andreas supports that.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.