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)

hello 09-15-2004 05:49 PM

i have installed and upgraded the warning hack but normal members can warn other members is there a setting to make it so that admins and mod or supermods can warn

WebTechTalk 09-15-2004 10:52 PM

Nice man! I'm clicking install button now!

sicloan 09-16-2004 04:26 AM

I have found a very annoying problem with this hack.

No offense but your function ParseInput wasnt very good and it is not handling the comments the way i want. It is not giving good pm results. Meaning i get the ASCII characters in my PM's when recieving a warning notice.

First i would like to thank the admin's over at www.battleforums.com for pointing this out. Proper grammar can really improve a forum's appearance and that is one of the reasons i want help with this problem.

I tried to use a function by vbulletin but thats not working. If you could please modify it that would be great.

j_86 09-16-2004 05:57 AM

Why not use the template mod suggested further back in this thread?

WebTechTalk 09-16-2004 08:21 PM

hmmm...I'm getting a Who is Online error aswel...having my programmer check it out.

hello 09-17-2004 05:39 AM

can someone please answer my question

sv1cec 09-17-2004 09:58 AM

Quote:

Originally Posted by hello
can someone please answer my question

Check page 14, the answer should be there.

Rgds

sicloan 09-20-2004 04:37 PM

Quote:

Originally Posted by sicloan
I have found a very annoying problem with this hack.

No offense but your function ParseInput wasnt very good and it is not handling the comments the way i want. It is not giving good pm results. Meaning i get the ASCII characters in my PM's when recieving a warning notice.

First i would like to thank the admin's over at www.battleforums.com for pointing this out. Proper grammar can really improve a forum's appearance and that is one of the reasons i want help with this problem.

I tried to use a function by vbulletin but thats not working. If you could please modify it that would be great.

If you didn know what i meant by this. Basically when i add a warning to someone, and i put a moderation comment on the warning, with apostrophe's or quotations, i get the ascii vaule. " or the number whatever it is.

sv1cec 09-21-2004 04:00 AM

Quote:

Originally Posted by sicloan
If you didn know what i meant by this. Basically when i add a warning to someone, and i put a moderation comment on the warning, with apostrophe's or quotations, i get the ascii vaule. " or the number whatever it is.

As I said before, you can replace the PM thing with a template-based message. However, I haven't registered all the changes I made, so it's not easy for me to provide step-by-step instructions. If you want, I can provide you with my files, for you to figure out.

Rgds

sicloan 09-21-2004 04:08 AM

Yea if you could send those my way that'd be great. Just pm me.

Also, I know it has something to do with the way the message is parsed from the database. ParseInput() is a decent function but it does not seem to deal with it the right way. And the pm text SHOULD be the same, unless you made a custom function for send_pm() but i didnt notice anything.

Thanks for the help, and i hope i can figure this problem out.

~Sicloan

Koutaru 09-22-2004 05:49 PM

Set it up with no problems! Thanks again for such an awesome hack and awesome work ;) I'd expect no less from you. :p

sv1cec 09-23-2004 11:26 AM

Quote:

Originally Posted by Koutaru
Set it up with no problems! Thanks again for such an awesome hack and awesome work ;) I'd expect no less from you. :p

For those who want to use a template for the PM send to the warned user, all you have to do is to create a template called "warn_pm" with the following contents:

HTML Code:

Dear $user[username],

You have been warned for one of your posts, which 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] [/b] point(s).

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

The admin/moderator who warned you, entered this comment:

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

Your total Warning Level at the moment is: [b] $level [/b] point(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][/b] days.

To see details about all the warnings you have received, until now, please click [URL="$vboptions[bburl]/Warn.php?do=ViewMyWarnings"]here[/URL].

Please reply back if you have a dispute.

Then in the warn.php file, comment out the following lines:

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); 

In case your message looks different than mine (I might have changed it), please comment out the two lines which start with $messageb.

Right below those two lines, add the following:

PHP Code:

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

Of course the template can be edited at will.

I hope this helps.

---------
John

sv1cec 09-23-2004 11:35 AM

One issue I had with this hack, is the fact that it uses a separate table, to maintain those members which get banned. If you do that, then you have to manually change their status to unbanned, when the banning period expires.

Why can't we use the normal table, in which vB stores the banned users, called "userban"? In that way, we can have the vB's cron job take care of the unbanning.

For those who are interested in this, all you have to do, is the followings:

In your warn.php file, find the following line:

PHP Code:

$DB->query("insert into ".TABLE_PREFIX."banned_members values ('','{$user['userid']}','".time()."','{$time_unban}')"); 

Replace it, with the followings:

PHP Code:

        if($warn_type['warn_permban']=="Yes")
            {
$liftdate=0;
             }
            else
            {
$liftdate=$time_unban;
             }
                 
$usergroupid=8
        $DB_site
->query("
            INSERT INTO " 
TABLE_PREFIX "userban
            (userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate)
            VALUES
            (
$user[userid]$user[usergroupid]$user[displaygroupid]$user[customtitle], '" addslashes($user['usertitle']) . "', $bbuserinfo[userid], " TIMENOW ", $liftdate)");
        
$DB_site->query("
                UPDATE " 
TABLE_PREFIX "user SET
                usergroupid = 
$usergroupid,
                displaygroupid = 
$usergroupid
                WHERE userid = 
$user[userid]
            "
); 

Of course, in this case, you do not use the option "Unban banned users" in your AdminCP, since the bans will no longer be in the table this hack is using, but in the table vB is creating.

Also, it is obvious, that if you use this mod of mine, any future improvements by the author of this hack, might not work, so use at your own risk.

I'll try to help anyone who has issues with the above mods, but I can't promise any response times.

Rgds
------------
John

Mosh 09-23-2004 11:36 AM

* jd clicks install *

I have been testing this for a while, it is great just installed it on my live forum.

I have made a few changes mostly conditionals so only staff can see the warn and view warn text in the postbit template, also added a Warn Level indicator for everyone (except staff) to see, also added the same in the MEMBERINFO template.

Thank you.

JD. :)

BeasTboyz 09-26-2004 01:28 AM

I get SQL errors when trying to send the message using both the original method by Zero Tolerance, and the template method by sv1cec

Here is the error with the stock code:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: insert into vb3_pmtext values ('','1','Matt','You have been warned','You have been warned for one of your posts: click here to see it. Your warning level is now: 5. Click on the Quick Links menu above and select View Your Warnings, to see details about all the warnings you have received. The person who warned you, entered this comment: test. Please reply back if you have a dispute.','a:1:{i:5;s:9:\"BeasTboyz\";}','4','1096165529','1','1')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Saturday 25th of September 2004 09:25:29 PM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/War...d=5&post=73439

I also can not use the ban fix created by sv1cec two posts up. I get an invalid T_VARIABLE on line 250, which happens to be the first instance of the code below:
Code:

        $DB_site->query("
If anyone knows how to fix these problems I would appreciate it, I've tried quite a few different things but I'm a novice at this sort of thing.

Thanks!

SamirDarji 09-26-2004 01:42 AM

Quote:

Originally Posted by jdsinclair
* jd clicks install *

I have been testing this for a while, it is great just installed it on my live forum.

I have made a few changes mostly conditionals so only staff can see the warn and view warn text in the postbit template, also added a Warn Level indicator for everyone (except staff) to see, also added the same in the MEMBERINFO template.

Thank you.

JD. :)

Mind sharing the code for the changes? I was thinking to do the same.

sv1cec 09-26-2004 05:10 AM

Quote:

Originally Posted by BeasTboyz
I get SQL errors when trying to send the message using both the original method by Zero Tolerance, and the template method by sv1cec

Here is the error with the stock code:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: insert into vb3_pmtext values ('','1','Matt','You have been warned','You have been warned for one of your posts: click here to see it. Your warning level is now: 5. Click on the Quick Links menu above and select View Your Warnings, to see details about all the warnings you have received. The person who warned you, entered this comment: test. Please reply back if you have a dispute.','a:1:{i:5;s:9:\"BeasTboyz\";}','4','1096165529','1','1')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Saturday 25th of September 2004 09:25:29 PM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/War...d=5&post=73439

I also can not use the ban fix created by sv1cec two posts up. I get an invalid T_VARIABLE on line 250, which happens to be the first instance of the code below:
Code:

        $DB_site->query("
If anyone knows how to fix these problems I would appreciate it, I've tried quite a few different things but I'm a novice at this sort of thing.

Thanks!

To use my modification for this hack, you have to add some more fields in the tables. For example, I have a field which says if the warning relates to an offence which deserves a permanent ban (such as for a troll). I'll try to help you, if you give me the exact error you get in my code and the line of the code it generates it (the line is not only the part you show above, give me the whole code statement).

Rgds
------------
John

BeasTboyz 09-26-2004 07:59 AM

Quote:

Originally Posted by sv1cec
To use my modification for this hack, you have to add some more fields in the tables. For example, I have a field which says if the warning relates to an offence which deserves a permanent ban (such as for a troll). I'll try to help you, if you give me the exact error you get in my code and the line of the code it generates it (the line is not only the part you show above, give me the whole code statement).

Rgds
------------
John

Thanks for the offer to help, John.

I have attached my Warn.php file so you can see exactly what it says.

When I change Warn.php so that it adds a user to the normal vB banned usergroup I get this error and this error only when attempting to warn a user or view their warning level:
Code:

Parse error: parse error, unexpected T_VARIABLE in /home/observed/public_html/vb/Warn.php on line 250
Here are some lines from my Warn.php file
Code:

243: if($warn_type['warn_permban']=="Yes")
244:            {$liftdate=0;
245:              }
246:            else
247:            {$liftdate=$time_unban;
248:            }
249:                $usergroupid=8
250:        $DB_site->query("
251:            INSERT INTO " . TABLE_PREFIX . "userban
252:            (userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate)
253:            VALUES
254:            ($user[userid], $user[usergroupid], $user[displaygroupid], $user[customtitle], '" . addslashes($user['usertitle']) . "', $bbuserinfo[userid], " . TIMENOW . ", $liftdate)");
255:        $DB_site->query("
256:                UPDATE " . TABLE_PREFIX . "user SET
257:                usergroupid = $usergroupid,
258:                displaygroupid = $usergroupid
259:                WHERE userid = $user[userid]
260:            ");


When I change the private message function so that it uses the template instead of the stock way it notifies a user of a warning I get this mySQL error:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: insert into vb3_pmtext values ('','1','Matt','You have been warned','Dear BeasTboyz,

You have been warned for one of your posts, which violated the Forums Rules.

The reason you have been warned is because Other reasons not listed (Warning Type = Miscellaneous), for which you have been given 2 point(s).

The post for which you are warned can be seen here.

The admin/moderator who warned you, entered this comment:

=======================================
test
=======================================

Your total Warning Level at the moment is: 5 point(s).

If you reach the maximum of 5, you will be banned from the Forums, for 3 days.

To see details about all the warnings you have received, until now, please click here.

Please reply back if you have a dispute.','a:1:{i:5;s:9:\"BeasTboyz\";}','4','1096188731','1','1')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Sunday 26th of September 2004 03:52:11 AM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/War...d=5&post=73439
Username: Matt
IP Address: xx.xx.xx.xx

Thanks again for any help,

Matt

sv1cec 09-26-2004 01:57 PM

Matt,

The first error is easy, you need to add a semicolon at the line which says:

$usergroupid=8

Change that to

$usergroupid=8;

As far as the second mistale is concerned, have you commented out both lines starting with "$messageb=...."? There are two lines there, looking like:

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); 

You have to comment these lines, add two // in front of each one of them, or just delete them. Then, add a row like:

PHP Code:

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

in their place.

My warn.php looks like that, in that area:

PHP Code:

eval('$messageb .= "' fetch_template('warn_pm') . '";');
$title="You have been warned";
$to=$user['userid'];
$from=$bbuserinfo['userid'];
SendPM($messageb,$title,$to,$from); 

Let me know if these help.

Rgds
----------
John

msimplay 09-26-2004 02:53 PM

i'd still like expirable warnings

sv1cec 09-26-2004 02:57 PM

Quote:

Originally Posted by msimplay
i'd still like expirable warnings

My mods provide for a "Warn Maturity". The warnings are automatically removed after they mature.

Rgds
----------
John

msimplay 09-26-2004 06:15 PM

Quote:

Originally Posted by sv1cec
My mods provide for a "Warn Maturity". The warnings are automatically removed after they mature.

Rgds
----------
John

from which page in this thread do i start searching ur mods a rough estimate please

BeasTboyz 09-26-2004 07:55 PM

Hey John, the first problem has been solved, the semicolon worked no problem.

I still have a problem with the private messaging though. The lines are uncommented just how you said to do and the next lines are just like yours. The SQL error is still the same though. You can view my Warn.php here if you want to verify anything for yourself.

Also, I warned my test account up to a ban and it went to the correct usergroup in the correct ban log (the one built into vB), but it said the ban was permanent. I have it set to 3 days in the Admin CP. If you have any idea what is going on with that I'd appreciate it.


Thanks for all the help,

Matt

Edit: just saw you run m1911.org, very :cool: Congrats on getting the forums running, I hadn't even seen them before. I always used http://forums.1911forum.com/ :) Anyhow, just wanted to let you know I've learned a LOT from your site

sv1cec 09-27-2004 03:42 AM

Matt,

Thanks for the nice words about M1911.ORG, appreciated. Yes, we have our own forums site running since June.

As for the mods, there were a couple of minor mistakes in your warn.php, so I had them corrected. I guess the problem with the eval statement was a dot, just before the = sign. Anyway, I attached it here.

Let me know if it works.

Rgds

msimplay 09-27-2004 07:03 AM

i hope two idea's i've seen on these forums make it into version 2.0
Expirable warnings
Can't warn same post twice

BeasTboyz 09-27-2004 09:13 AM

sv1cec, It didn't work. The first problem I had was that I needed a new colum in warn_types called warn_maturity. I made that, but now I'm still getting the problem with the PM function:

Code:

Database error in vBulletin 3.0.3:

Invalid SQL: insert into vb3_pmtext values ('','1','Matt','You have been warned','Dear BeasTboyz,

You have been warned for one of your posts, which violated the Forums Rules.

The reason you have been warned is because Other reasons not listed (Warning Type = Miscellaneous), for which you have been given 2 point(s).

The post for which you are warned can be seen here.

The admin/moderator who warned you, entered this comment:

=======================================
test
=======================================

Your total Warning Level at the moment is: 5 point(s).

If you reach the maximum of 6, you will be banned from the Forums, for 3 days.

To see details about all the warnings you have received, until now, please click here.

Please reply back if you have a dispute.','a:1:{i:5;s:9:\"BeasTboyz\";}','4','1096279642','1','1')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Monday 27th of September 2004 05:07:22 AM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/War...d=5&post=73439
Username: Matt
IP Address: xx.xx.xx.xx

Is the problem with the pmtextid column in my vb3_pmtext table? It seems like its possibly trying to enter the wrong pmtextid (*) instead of the next relevant number? This is just a shot in the dark here of course, I don't really know.

If you have any ideas I'd appreciate it :).

Matt

sv1cec 09-27-2004 10:22 AM

Quote:

Originally Posted by BeasTboyz
sv1cec, It didn't work. The first problem I had was that I needed a new colum in warn_types called warn_maturity. I made that, but now I'm still getting the problem with the PM function:

Is the problem with the pmtextid column in my vb3_pmtext table? It seems like its possibly trying to enter the wrong pmtextid (*) instead of the next relevant number? This is just a shot in the dark here of course, I don't really know.

If you have any ideas I'd appreciate it :).

Matt

Matt,

I found a few more differences between your warn.php and mine. I am attaching your file with the new code. It is in the SQL Query that inserts those values in the omtext table. The problem is that I haven't touched that part of the code myself, so I guess we have a ... version discrepancy here.

Let me know if this one works.

John

sv1cec 09-27-2004 10:25 AM

Quote:

Originally Posted by msimplay
i hope two idea's i've seen on these forums make it into version 2.0
Expirable warnings
Can't warn same post twice

Expirable warnings are there today, you will just have to figure out some things yourself, as I haven't kept notes on my changes.

As for not warning the same post twice, I think I've got it working by adding the following code:

PHP Code:

if($postwarnedalready=$DB->query_first("select warned_post from ".TABLE_PREFIX."warnings where warned_post='{$_GET['post']}'"))
{
RunError("This post has already been warned for. You cannot issue another warning for it.");


in your warn.php file, just before the line :

PHP Code:

// User Exists? 

The User Exists line is found twince in the code, I am not sure if you should add the above if statement in both instances, I think you should. Let me know if it works OK.

Rgds

John

msimplay 09-27-2004 10:51 AM

Quote:

Originally Posted by sv1cec
Expirable warnings are there today, you will just have to figure out some things yourself, as I haven't kept notes on my changes.

As for not warning the same post twice, that's easy to implement, only one query to the warnings table. However, I do not have the time to do it right now. If I manage to get it, I'll post the code here.

Rgds

yeh i found the expirable warnings bit it will suffice for now
however it would be good to have it intergrated into the hack itself for example the way it was in mikes warning hack for vb2

Spamming expires 30 days
Rudeness expires 1 day
Signature expires 30 days

its settable per warning but the way i found in this thread was as a whole 30 days from the time set per warning

BeasTboyz 09-27-2004 10:55 AM

Quote:

Originally Posted by sv1cec
Matt,

I found a few more differences between your warn.php and mine. I am attaching your file with the new code. It is in the SQL Query that inserts those values in the omtext table. The problem is that I haven't touched that part of the code myself, so I guess we have a ... version discrepancy here.

Let me know if this one works.

John

Wow John, thanks for all of your help!

It appears to be working great now :D except for two small things.

1.) If a user has a warning level of 5 and the ban level is 6 and I give them a warning worth 2 points it takes the level up to 6, but when I remove the warning it keeps an extra point in "reserve" that I can't seem to erase. I can of course go into the my user table and remove it from the last column, but I thought I'd let you know in case you want to fix it.

2.) At the bottom of the Warn.php interface (on the site) it says "Once you reach warning level 6, you will be banned for 3 days". Well, I'm not banning them, I have a usergroup on my site I add them to called the Kiddie Korner, and that is the only place they're allowed to post. I would like to say "Once you reach warning level 6, you will be moved to the Kiddie Korner for 3 days"

sv1cec 09-27-2004 11:29 AM

Quote:

Originally Posted by msimplay
yeh i found the expirable warnings bit it will suffice for now
however it would be good to have it intergrated into the hack itself for example the way it was in mikes warning hack for vb2

Spamming expires 30 days
Rudeness expires 1 day
Signature expires 30 days

its settable per warning but the way i found in this thread was as a whole 30 days from the time set per warning

That's the way it works in my mod. You define a maturity period per warning type. When that period passes, that warning is removed. So you can adjust it the way you want.

As I said, if you care, it's here, but don't expect me to provide step-by-step instructions, I just do not have them. I'll try to help you out, but that's all I can do.

Rgds
--------
John

sv1cec 09-27-2004 11:33 AM

Quote:

Originally Posted by BeasTboyz
Wow John, thanks for all of your help!

It appears to be working great now :D except for two small things.

1.) If a user has a warning level of 5 and the ban level is 6 and I give them a warning worth 2 points it takes the level up to 6, but when I remove the warning it keeps an extra point in "reserve" that I can't seem to erase. I can of course go into the my user table and remove it from the last column, but I thought I'd let you know in case you want to fix it.

2.) At the bottom of the Warn.php interface (on the site) it says "Once you reach warning level 6, you will be banned for 3 days". Well, I'm not banning them, I have a usergroup on my site I add them to called the Kiddie Korner, and that is the only place they're allowed to post. I would like to say "Once you reach warning level 6, you will be moved to the Kiddie Korner for 3 days"

Matt,

The minute I say "OK, I can go and rest a bit", here you come with a different thing! LoL I'll have to check on the first one, this is a tough one, because the hack works initially like that, when you reach the limit, it resets itself at the limit. I can change that, but I need to check what impact it will have overall.

As for the second point, just alter your warn_viewtype_end template. Easy enough, if not let me know.

Now, I go rest, before the twins wake up and my baby-sitting session starts.

Rgds

BeasTboyz 09-27-2004 11:37 AM

Quote:

Originally Posted by sv1cec
Matt,

The minute I say "OK, I can go and rest a bit", here you come with a different thing! LoL I'll have to check on the first one, this is a tough one, because the hack works initially like that, when you reach the limit, it resets itself at the limit. I can change that, but I need to check what impact it will have overall.

Sorry about that. Like I said though, it doesn't matter to me too much, can do it by hand. I just wanted to bring it to your attention.

Quote:

Originally Posted by sv1cec
As for the second point, just alter your warn_viewtype_end template. Easy enough, if not let me know.

Rgds

Ah, I forgot to check my templates, thanks for reminding me :).

Thanks for all of the help,

Matt

sv1cec 09-27-2004 11:48 AM

Quote:

Originally Posted by BeasTboyz
Sorry about that. Like I said though, it doesn't matter to me too much, can do it by hand. I just wanted to bring it to your attention.



Ah, I forgot to check my templates, thanks for reminding me :).

Thanks for all of the help,

Matt

Matt,

I am aware of this problem, it's just that I am not sure which is the best way to handle it. I assume that in some cases, leaving the code as it is, is a better option, in other cases, it's better to have a warning level above the limit, like when deleting warnings.

To do it the way you want (i.e. to work properly when removing a warning, as far as the rremoved points are concerned), find the following line:

PHP Code:

if($level>$warn_options['points_before_banned']){$level=$warn_options['points_before_banned'];} 

and make it a comment by adding two // in the beginning. In other words, it should look like:

PHP Code:

//if($level>$warn_options['points_before_banned']){$level=$warn_options['points_before_banned'];} 

Let me know if it works to your satisfaction.

----------
John

BeasTboyz 09-27-2004 12:10 PM

Quote:

Originally Posted by sv1cec
Matt,

I am aware of this problem, it's just that I am not sure which is the best way to handle it. I assume that in some cases, leaving the code as it is, is a better option, in other cases, it's better to have a warning level above the limit, like when deleting warnings.

To do it the way you want (i.e. to work properly when removing a warning, as far as the rremoved points are concerned), find the following line:

PHP Code:

if($level>$warn_options['points_before_banned']){$level=$warn_options['points_before_banned'];} 

and make it a comment by adding two // in the beginning. In other words, it should look like:

PHP Code:

//if($level>$warn_options['points_before_banned']){$level=$warn_options['points_before_banned'];} 

Let me know if it works to your satisfaction.

----------
John

Hey John,

That brings up errors when someone is already one below the ban level and I try to warn them again (to bring them 1 above the ban level), SQL errors:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: 
            INSERT INTO vb3_userban
            (userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate)
            VALUES
            (5, 10, 10, 0, '', 1, 1096290247, 1096549448)
mysql error: Duplicate entry '5' for key 1

mysql error number: 1062

Date: Monday 27th of September 2004 08:04:08 AM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/Warn.php?do=WarnUser&id=5&post=73439
Username: Matt
IP Address: xx.xx.xx.xx

In the mean time I'm uncommenting it and I'm going to just make all warnings worth 1 point and make the ban level 3.

Matt

sv1cec 09-27-2004 05:49 PM

Quote:

Originally Posted by BeasTboyz
Hey John,

That brings up errors when someone is already one below the ban level and I try to warn them again (to bring them 1 above the ban level), SQL errors:
Code:

Database error in vBulletin 3.0.3:

Invalid SQL: 
            INSERT INTO vb3_userban
            (userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate)
            VALUES
            (5, 10, 10, 0, '', 1, 1096290247, 1096549448)
mysql error: Duplicate entry '5' for key 1

mysql error number: 1062

Date: Monday 27th of September 2004 08:04:08 AM
Script: http://www.observedtrials.net/vb/Warn.php
Referer: http://www.observedtrials.net/vb/Warn.php?do=WarnUser&id=5&post=73439
Username: Matt
IP Address: xx.xx.xx.xx

In the mean time I'm uncommenting it and I'm going to just make all warnings worth 1 point and make the ban level 3.

Matt

Nope, this is not the problem, at least the SQL error you send me, does not show this. What it shows is that user with userid 5 is already banned, so you cannot re-ban him again.

That's another issue I have to deal with.

See that the statement that is causing the problem, is the one which inserts an entry in the userban table, this is the table where the banned users are inserted. Now, I remember that you said that you do not ban the users, you just move them to another user group, so I am not sure how you want this handled. To verify that this is the case (I am sure it is), just comment that line, it should still increase the warn points for that user, but it will not enter his entry in the userban table.

If you do not plan to ban users, then you'd better stick with the original hack, which allows you to move your users to another usergroup, and when the maturity period is over, they can be re-moved back to their original group. But this has to be done manually, from the "Unban members" option in the AdminCP.

Matt, it's hard for me to suggest the best alternative, as I do not have in mind all the details of your environment.

If you can come up with some guidelines (e-mail me directly), I'll try to help, but as mentionned before, I cannot commit to anything.

Rgds
-----------
John

Mosh 09-30-2004 03:31 AM

Quote:

Originally Posted by SamirDarji
Mind sharing the code for the changes? I was thinking to do the same.

Yep, no probs. It is not neat or the most efficient code, but it works for me (not a coder myself but have started to experiment). Only tested on v3.0.3. These changes will have to be made in every style you use.

The only thing viewable by a member is the Warn Level (all members are displayed for everyone to see) and their warning page (only viewable by them and staff). My staff love this as originally everyone saw all links.



You will have to reference with ZT's original instructions to see what is different for the 'postbit' template (additional navbar and MEMBERINFO template alterations by me):


1. In the 'postbit' template (you will have to find the equivalent place in the 'postbit_legacy' template yourself as I do not use it), Warn and View Warning only seen by staff. Warn Level are displayed for members (when level is above zero it changes colour). You can change the font colours to whatever you want.

Postbit Templates -> postbit:-

Find:
PHP Code:

<if condition="$show['postcount']">#<a 

Replace with:
PHP Code:

<if condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$bbuserinfo['usergroupid'] == 5 OR $bbuserinfo['usergroupid'] == 6 OR $bbuserinfo['usergroupid'] == 7"><a href='Warn.php?do=WarnUser&id=$post[userid]&post=$post[postid]'><font color=orange>Warn $post[musername]</font></a>&nbsp;&nbsp;<a href='Warn.php?do=ViewWarnings&id=$post[userid]'><font color=yellow>View $post[musername]'s Warnings</font></a>&nbsp;&nbsp;</if></if><if condition="$show['postcount']">#<a 

Find:
PHP Code:

                    <if condition="$post['age']"><div>$vbphrase[age]: $post[age]</div></if>
                    <
div>
                        
$vbphrase[posts]: $post[posts]
                    </
div

Under it Add:
PHP Code:

                <if condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$post['warning_level'] == 0"><div class="smallfont">Warning Level$post[warning_level]</div></if></if>
                                <if 
condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$post['warning_level']>0"><div class="smallfont"><font color=yellow>Warning Level$post[warning_level]</font></div></if></if> 


2. I put a 'View My Warnings' link in 'Quick Links' on the navbar (as staff can't get warned they will not see this).

Navigation / Breadcrumb Templates -> navbar:-

Find:
PHP Code:

<tr><td class="thead">$vbphrase[miscellaneous]</td></tr

Above it add:
PHP Code:

<if condition="$bbuserinfo['usergroupid'] == 5 OR $bbuserinfo['usergroupid'] == 6 OR $bbuserinfo['usergroupid'] == 7"><else /><tr><td class="thead">Warnings</td></tr><tr><td class="vbmenu_option"><a href="Warn.php?$session[sessionurl]do=ViewMyWarnings">View My Warnings</a></td></tr></if> 


3. For members public profiles I have added a view warnings (viewable by staff only) and Warning Level (everyone can see)

Member Info Templates -> MEMBERINFO:-

Find:
PHP Code:

    <td class="tcat">$vbphrase[view_profile]<span class="normal">: $userinfo[username]</span></td

Replace with:
PHP Code:

    <td class="tcat">$vbphrase[view_profile]<span class="normal">: $userinfo[username]<if condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$bbuserinfo['usergroupid'] == 5 OR $bbuserinfo['usergroupid'] == 6 OR $bbuserinfo['usergroupid'] == 7">&nbsp;&nbsp;<a href='Warn.php?do=ViewWarnings&id=$post[userid]'><font color=yellow>View $post[musername]'s Warnings</font></a>&nbsp;&nbsp;</if></if></span></td> 

Find:
PHP Code:

                <if condition="$show['lastactivity']">
                    <
div>$vbphrase[last_activity]: $userinfo[lastactivitydate] <span class="time">$userinfo[lastactivitytime]</span>&nbsp;</div>
                </if> 

Above it Add:
PHP Code:

                <if condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$post['warning_level'] == 0"><div class="smallfont">Warning Level$post[warning_level]&nbsp;</div></if></if>
                                <if 
condition="$post['usergroupid'] == 5 OR $post['usergroupid'] == 6 OR $post['usergroupid'] == 7"><else /><if condition="$post['warning_level']>0"><div class="smallfont"><font color=yellow>Warning Level$post[warning_level]</font>&nbsp;</div></if></if> 



That is all I really did, so if you find use for it go right ahead and use it :)

JD. :)

SamirDarji 09-30-2004 06:59 AM

Thank you very much. I'm putting the finishing touches on my new site and want to have these same features. I'm no coder either, so I won't tell. ;)

fridayweb 09-30-2004 09:06 PM

I would like other groups to be able to see the warned reasons, besides those that can moderate. I haven't been able to figure out how to do this yet. Any suggestions?

sv1cec 10-01-2004 04:02 AM

Quote:

Originally Posted by fridayweb
I would like other groups to be able to see the warned reasons, besides those that can moderate. I haven't been able to figure out how to do this yet. Any suggestions?

The warned reasons are inside the "View Warnings" area (so to speak). In order for other groups to be able to see that link, you will have to change the conditional, which preceeds this link, in the postbit or postbit_legacy templates. For example:

PHP Code:

<if condition="$post[usergroupid]!=6 AND $post[usergroupid]!=7 AND ($bbuserinfo[usergroupid]==7 OR $bbuserinfo[usergroupid]==6)">
<
a href='Warn.php?do=ViewWarnings&id=$post[userid]'>View $post[username]'s Warnings</a> ?
</if> 

The conditional above checks if the post :

1. Is not made by an admin or a mod.
2. If the member viewing the post is either a mod or admin.

If these are true, it shows the "View Warnings" link. You may add other conditions within the OR parenthesis, to show the link to other groups.

Rgds


All times are GMT. The time now is 02:26 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.02267 seconds
  • Memory Usage 2,031KB
  • 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
  • (10)bbcode_code_printable
  • (1)bbcode_html_printable
  • (24)bbcode_php_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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