Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by holev holev is offline
Developer Last Online: Jul 2006 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 11-30-2001 Last Update: Never Installs: 8
Is in Beta Stage  
No support by the author.

having to send warning PMs and Emails 'manualy' everyime I wanted to let my users know they'r breaking the forum's rules
made me make this small hack to automaticaly send a PM and a email with a preset msg for the type of rule he broke.
It also changes the user's info to make the PM popup. I commented it out of the script.

This is how I did it:

I created a new file named 'warnuser.php' (you can also very easily enter it in 'user.php') with this code in it:
PHP Code:
<?php
// alter table user add column warnings int default 0;
error_reporting(7);

require(
"./global.php");

## Edit Vars: ##
$ban 1// 0 = Never ban nomatter what; 1 = Ban after $numwarn has been passed
$numwarn 3// Number of warnings till user gets banned
$bannedgrp 13// Group id for banned users
## End Vars ##

$warning["new_spammer"]["title"] = "[Warning] Spamming On holev.com Forums!";
$warning["new_spammer"]["msg"] = "Considering you are a relatively new member I am letting you know that this forum does not tolerate spammers. Either you stop spamming or you will be banned.";

$warning["spammer"]["title"] = "[Warning] Spamming On holev.com Forums!";
$warning["spammer"]["msg"] = "I am letting you know that either you stop spamming or you will be banned.";

$warning["flamer"]["title"] = "[Warning] Flaming On holev.com Forums!";
$warning["flamer"]["msg"] = "I am letting you know that either you stop flaming or you will be banned.";

if(isset(
$touserid)) {
    
$DB_site->query("update user set pmpopup='1',warnings=warnings+1 where userid='$touserid'");
    
$useri $DB_site->query_first("select * from user where userid='$touserid'");
    if((
$useri[warnings] == "1") or ($ban == 0)) {
        
$DB_site->query("INSERT INTO privatemessage (touserid,userid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($warning[$why][title]))."','".addslashes($warning[$why][msg])."',".time().",'1','0',0,0)"); 
        
mail($toemail,$warning[$why]["title"],$warning[$why]["msg"],"From: \"$bbtitle Mailer\" <$webmasteremail>");
        echo 
"User Warned.";
    } elseif(
$useri[warnings] > $numwarn) {
        
$bannedtl "[holev forums] You have been banned.";
        
$bannedmsg "You ignored the warnings and got yourself banned. congrats.";
        
$DB_site->query("update user set usergroupid=$bannedgrp where userid='$touserid'");
        
$DB_site->query("INSERT INTO privatemessage (userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($bannedtl))."','".addslashes($bannedmsg)."',".time().",'1','0',0,0)");
        
mail($toemail,$bannedtl,$bannedmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
        echo 
"User BANNED.";
    }
} else {
    echo 
"eeek";
}
?>
then I opened up 'user.php' and right above this line of code (near line 200):
PHP Code:
<li>".makelinkcode("Send email to $user[username]","mailto:$user[email]")."</li
I added:
PHP Code:
<li>Warn $user[warnings] ): ".makelinkcode("Spamming","warnuser.php?touserid=$user[userid]&why=spammer&toemail=$user[email]")." ".makelinkcode("First Spam","warnuser.php?touserid=$user[userid]&why=new_spammer&toemail=$user[email]")." ".makelinkcode("Flaming","warnuser.php?touserid=$user[userid]&why=flamer&toemail=$user[email]")."</li
Ran This SQL command:
Code:
alter table user add column warnings int default 0;
Updates
=======
v0.3 - Fixed a silly PM sending mistake
v0.2 - Added a warning counter that bans the user when counter exceeds the limit
=======

Hope this comes in handy for some of you.
please post any suggestions / improvements you might have.[PHP]

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 01-02-2002, 07:41 PM
TheMann TheMann is offline
 
Join Date: Dec 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way that this can be used from the actual post and not from the CP so that the Moderators can issue the warning too?

That would be great
Reply With Quote
  #13  
Old 01-03-2002, 12:34 AM
risestar risestar is offline
 
Join Date: Oct 2001
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The latter section of warn user.php looks something like this. Compare to one above and you will see what I mean

$DB_site->query("INSERT INTO privatemessage (touserid,userid,fromuserid,title,message,dateline ,showsignature,iconid,messager ead,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($warning[$why][title]))."','".addslashes($warning[$why][msg])."',".time().",'1','0',0,0)");
mail($toemail,$warning[$why]["title"],$warning[$why]["msg"],"From: \"$bbtitle Mailer\" <$webmasteremail>");
echo "User Altered To Need to Read Status and Email sent.";
} elseif($useri[warnings] > $numwarn) {
$bannedtl = "You have been suspended.";
$bannedmsg = "You have broken some forum rules and your posting privliges have been suspended. Contact An administrator regarding re-instatement.";
$DB_site->query("update user set usergroupid=$bannedgrp where userid='$touserid'");
$DB_site->query("INSERT INTO privatemessage (userid,touserid,fromuserid,title,message,dateline ,showsignature,iconid,messager ead,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($bannedtl))."','". addslashes($bannedmsg)."',".ti me().",'1','0',0,0)");
mail($toemail,$bannedtl,$bannedmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
echo "User Altered To Need to Read Status and Email sent.";
Reply With Quote
  #14  
Old 01-03-2002, 04:21 AM
Lucky Lucky is offline
 
Join Date: Dec 2001
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK

I am still getting banned user pm sent to me the administrator from instead of the banned user. However the email option works like a charm. I just need the pm to go to the banned users instead of to me. Any ideas?

This is what I have:

PHP Code:
<?php
// alter table user add column warnings int default 0;
error_reporting(7);

require(
"./global.php");

## Edit This: ##
$ban 1// 0 = Never ban nomatter what; 1 = Ban after $numwarn has 

been passed
$numwarn 
3// Number of warnings till user gets banned
$bannedgrp 13// Group id for banned users
## Stop Editing ##

$warning["new_spammer"]["title"] = "[FIRST Warning] Spamming on Forums!";
$warning["new_spammer"]["msg"] = "Considering you are a relatively new 

member I am letting you know that this forum does not tolerate 

spammers. Either you stop spamming or you will be banned! This is your 

first warning!"
;

$warning["spammer"]["title"] = "[SECOND Warning] Spamming on forums!";
$warning["spammer"]["msg"] = "I am letting you know that either you 

stop spamming or you will be banned. This is your last warning!"
;

$warning["flamer"]["title"] = "[Warning] Flaming on Forums!";
$warning["flamer"]["msg"] = "I am letting you know that either you stop 

flaming or you will be banned. You have been warned!"
;

if(isset(
$touserid)) {
    
$DB_site->query("update user set pmpopup='1',warnings=warnings+1 

where userid='
$touserid'");
    
$useri $DB_site->query_first("select * from user where 

userid='
$touserid'");
    if((
$useri[warnings] == "1") or ($ban == 0)) {
        
$DB_site->query("INSERT INTO privatemessage 

(touserid,userid,fromuserid,title,message,dateline,showsignature,iconid

,messageread,folderid) VALUES 

(
$touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlsp

ecialchars
($warning[$why][title]))."','".addslashes($warning[$why][msg]

).
"',".time().",'1','0',0,0)");
        

mail($toemail,$warning[$why]["title"],$warning[$why]["msg"],"From: 

"
$bbtitle Mailer" <$webmasteremail>");
        echo 
"User Altered To Need to Read Status and Email sent.";
    } elseif(
$useri[warnings] > $numwarn) {
        
$bannedtl "[forums] You have been suspended.";
        
$bannedmsg "You have broken some forum rules and your posting 

privliges have been suspended. Contact An administrator regarding 

re-instatement."
;
        
$DB_site->query("update user set usergroupid=$bannedgrp where 

userid='
$touserid'");
        
$DB_site->query("INSERT INTO privatemessage 

(userid,touserid,fromuserid,title,message,dateline,showsignature,iconid

,messageread,folderid) VALUES 

(
$touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlsp

ecialchars
($bannedtl))."','".addslashes($bannedmsg)."',".time().",'1','

0',0,0)"
);
        
mail($toemail,$bannedtl,$bannedmsg,"From: "$bbtitle Mailer" 

<
$webmasteremail>");
        echo 
"User Altered To Need to Read Status and Email sent.";
    }
} else {
    echo 
"eeek";
}
?>
So do you see anything wrong in the above?
TIA
Reply With Quote
  #15  
Old 01-03-2002, 04:32 AM
risestar risestar is offline
 
Join Date: Oct 2001
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, there are 2 instances in warnuser.php where you need to reverse the touserid and userid

You did the top one, but look further down, you forgot the second one

Once complete, it should resemble this

-----------
<?php
// alter table user add column warnings int default 0;
error_reporting(7);

require("./global.php");

## Edit This: ##
$ban = 1; // 0 = Never ban nomatter what; 1 = Ban after $numwarn has been passed
$numwarn = 0; // Number of warnings till user gets banned
$bannedgrp = 30; // Group id for banned users
## Stop Editing ##

$warning["new_spammer"]["title"] = "[Warning] Spamming On DSSChat.com Forums!";
$warning["new_spammer"]["msg"] = "You have been caught spamming the DSSChat.com Forums. Your posting access to the forums has been suspended. You can contact an administrator for consideration at re-instatement.";

$warning["spammer"]["title"] = "[Warning] Off-Topic Posting on DSSChat Forums!";
$warning["spammer"]["msg"] = "You have violated some rules on the DSSChat Forum, usually an off-topic post where is does not belong. Your posting access to the forums has been suspended. You can contact an administrator regarding re-instatement.";

$warning["flamer"]["title"] = "[Warning] Flaming On DSSChat.com Forums!";
$warning["flamer"]["msg"] = "You have violated some rules on DSSChat Forums, usually flaming other users or other un-acceptable conduct. Your posting access to the forums has been suspended. You can contact an administrator regarding re-instatement.";

if(isset($touserid)) {
$DB_site->query("update user set pmpopup='1',warnings=warnings+1 where userid='$touserid'");
$useri = $DB_site->query_first("select * from user where userid='$touserid'");
if(($useri[warnings] == "1") or ($ban == 0)) {
$DB_site->query("INSERT INTO privatemessage (touserid,userid,fromuserid,title,message,dateline ,showsignature,iconid,messager ead,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($warning[$why][title]))."','".addslashes($warning[$why][msg])."',".time().",'1','0',0,0)");
mail($toemail,$warning[$why]["title"],$warning[$why]["msg"],"From: \"$bbtitle Mailer\" <$webmasteremail>");
echo "User Altered To Need to Read Status and Email sent.";
} elseif($useri[warnings] > $numwarn) {
$bannedtl = "You have been suspended.";
$bannedmsg = "You have broken some forum rules and your posting privliges have been suspended. Contact An administrator regarding re-instatement.";
$DB_site->query("update user set usergroupid=$bannedgrp where userid='$touserid'");
$DB_site->query("INSERT INTO privatemessage (userid,touserid,fromuserid,title,message,dateline ,showsignature,iconid,messager ead,folderid) VALUES ($touserid,$bbuserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($bannedtl))."','". addslashes($bannedmsg)."',".ti me().",'1','0',0,0)");
mail($toemail,$bannedtl,$bannedmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
echo "User Altered To Need to Read Status and Email sent.";
}
} else {
echo "eeek";
}
?>
-----------
Reply With Quote
  #16  
Old 01-03-2002, 07:11 AM
Lucky Lucky is offline
 
Join Date: Dec 2001
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got her.

Thanx.
Reply With Quote
  #17  
Old 01-05-2002, 07:51 AM
DelusionalMind's Avatar
DelusionalMind DelusionalMind is offline
 
Join Date: Dec 2001
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice

gonna come in handy on my board

thanks
Reply With Quote
  #18  
Old 01-11-2002, 08:42 AM
holev holev is offline
 
Join Date: Nov 2001
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry for not beeing here to maintain this hack.
hack updated and fixed.. thanks for your feedback.

[QUOTE]Originally posted by inetd
Make please so that it was possible to do make warning with board, and not just from Admin CP.
Reply With Quote
  #19  
Old 01-31-2002, 07:54 PM
TheMann TheMann is offline
 
Join Date: Dec 2001
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[QUOTE]Originally posted by holev




thats more of a template edit..
just edit your 'postbit' templete with the link of the warnuser with propper vars attached.
Reply With Quote
  #20  
Old 02-24-2002, 11:23 PM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd like to see this enabled for mods as well in the Moderator's admin CP, if that's at all possible.
Reply With Quote
  #21  
Old 02-27-2002, 01:53 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[QUOTE]Originally posted by risestar
I installed this and it works ok, except that I got the Pm instead of the user.

I noticed this userid,touserid
and $bbuserinfo[userid],$touserid

and reversed it and now it works fine and sends out to the user instead of me.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05646 seconds
  • Memory Usage 2,380KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete