vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Warning Hack V1.5 (https://vborg.vbsupport.ru/showthread.php?t=65336)

Jag 08-09-2004 03:03 AM

AWESOME HACK!!!

Installed quickly and easily, and works WONDERFULLY! :D


* Clicks Install

Jag 08-09-2004 03:51 AM

Ok, I've made a little script that should go through and delete any warns that are more then a month old :)

Simply upload this script to your webserver, and set up a Scheduled Task (in your vB AdminCP) to run it once a day :)

Snatch 08-09-2004 06:27 AM

Great, but i need a Script that unbann all Banned user after the Bantime.

sv1cec 08-09-2004 06:28 AM

I am afraid this is not as simple as that.

If you are to delete aged warnings (and I believe one should do that), the task is a bit more involved than just deleting the warnings themselves. I believe that you should also reduce the points the member has accumulated, until that time, by the number of points associated with the warning you delete.

I tried to do such a thing, but it gets too complicated for my knowledge of queries. You have to fetch the user id, then go to the warnings table, get the warned_warning_id and from their find how many points are associated with this warning type and subtract these points from the user table. If you can do that, I guess you are solving one of the major issues with this hack.

And of course, the un-banning script will be a welcome improvement too.

Rgds

sv1cec 08-09-2004 08:31 AM

Some people (me included) had expressed the hope that the PM send to the members when they are warned, is formed by an easy-to-adapt template. Well, I've managed to do it, so here are some details:

In Warn.php, find :

PHP Code:

$messageb="You have been warned for one of your posts: [url={$vboptions[bburl]}/showthread.php?p={$_POST['post']}]click here to see it[/url]. Your warning level is now: {$level}. Click on the [b]Quick Links[/b] menu above and select [b]View Your Warnings[/b], to see details about all the warnings you have received. The person who warned you, entered this comment: [i]{$_POST['comment']}[/i]. Please reply back if you have a dispute.";
$messageb=ParseInput($messageb); 

Replace these lines with :

PHP Code:

eval('$messageb = "' fetch_template('warn_pm') . '";'); 

Then create a template named "warn_pm" and inside it use the followings:

PHP Code:

Dear $user[username],

You have been warned for one of your postswhich violated the Forums Rules.

The reason you have been warned is because [b][i$warn_type[warn_desc] [/i][/b](Warning Type $warn_type[warn_name]), for which you have been given [b$warn_type[warn_points] [/bpoint(s).

The post for which you are warned can be seen [URL="$vboptions[bburl]/showthread.php?p=$_POST[post]"]here[/URL].

The person who warned youentered this comment

[
i]$_POST[comment][/i]

Your total Warning Level at the moment is: [b$level [/bpoint(s).

If 
you reach the maximum of [b]$warn_options[points_before_banned][/b], you will be banned from the Forums, for [b]$warn_options[banned_limit][/bdays.

To see details about all the warnings you have receiveduntil nowplease click [URL="$vboptions[bburl]/Warn.php?do=ViewMyWarnings"]here[/URL].

Please reply back if you have a dispute

I hope this helps.

Rgds

sv1cec 08-09-2004 11:11 AM

After a lot of trial-and-error, I've managed to improve on Jag's script above.

The script below, will test every warning to see if it is more than a month old. If it is, it will erase the warning and reduce the points of the member by the number of points that warning had.

One question Jag, that number you used, $date = $today-240800, the 240800, where does it come from? I believe that it should be $date = $today-2592000 (for 30 days x 24 hours x 60 minutes x 60 seconds).

Here is my script:

PHP Code:

<?php
/*======================================================================*\
|| #################################################################### ||
|| # vB3 Warn System V1 By Zero Tolerance [http://gzevolution.net]    ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''kill_warns');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// Global Requirements & Functions
    
require_once('./global.php');
    require_once(
'./includes/functions_user.php');


$DB=$DB_site// What? Its easier to write ^_^;
$warn_page=""// Template Var

$today time();
$date $today-2592000;

$warn=$DB->query("select w.*,wt.*,u.* from ".TABLE_PREFIX."warnings w left join ".TABLE_PREFIX."warning_types wt on(wt.tid=w.warned_warning_id) left join ".TABLE_PREFIX."user u on(u.userid=w.warned_user)");

while(
$warns=$DB->fetch_array($warn))
{
// update user's warn level
if (vbdate($vboptions['dateformat'], $warns[warned_time]) == vbdate($vboptions['dateformat'],$date)) 
{
$level=($warns['warning_level']-$warns['warn_points']);
$level=(int)$level;
if(
$level<1){$level=0;}

$DB->query("update ".TABLE_PREFIX."user set warning_level='{$level}' where userid='{$warns['userid']}'");
$DB_site->query("DELETE FROM " TABLE_PREFIX "warnings WHERE wid='{$warns['wid']}'");
}
}

log_cron_action('Old Warnings deleting script was run'$nextitem);

?>

Rgds

lifesourcerec 08-10-2004 05:09 AM

Who all have access to warn? Can super moderators and moderators have access?

sv1cec 08-10-2004 05:19 AM

Quote:

Originally Posted by lifesourcerec
Who all have access to warn? Can super moderators and moderators have access?

I do not use supermoderators. The way mine is set up, is that moderators can always see the "View XYZ's warnings". They see the "Warn XYZ" only in the forums they moderate. Admin sees both links everywhere. User sees only "View my warnings" in his own posts, but other users can see his overall warning points in his posts.

Rgds

lifesourcerec 08-10-2004 05:24 AM

Quote:

Originally Posted by sv1cec
I do not use supermoderators. The way mine is set up, is that moderators can always see the "View XYZ's warnings". They see the "Warn XYZ" only in the forums they moderate. Admin sees both links everywhere. User sees only "View my warnings" in his own posts, but other users can see his overall warning points in his posts.

Rgds

Is that default? I want moderators to only have access for the forums they moderate. Something else that would be nice is to be able to add it to postbit such as:

Quote:

Join Date:
Posts: 200
Warnings (0)
Feedback: 10
That way users will know to view warnings or not.

sv1cec 08-10-2004 05:41 AM

Quote:

Originally Posted by lifesourcerec
Is that default? I want moderators to only have access for the forums they moderate. Something else that would be nice is to be able to add it to postbit such as:



That way users will know to view warnings or not.

This is what I have, yes, you can show the warning points in the postbit.

To see how mine looks like go to:

http://forum.m1911.org/showthread.php?t=597

Now if you were logged in as a user, in your posts, you would also see the "View my warnings" link too.

Word of caution. After all the customization I've done to this hack, I am not sure of what comes with it and what I added. So please take my response as a "yes, in my case.".

Thanks


All times are GMT. The time now is 02:49 AM.

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.01710 seconds
  • Memory Usage 1,785KB
  • 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
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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