Version: , by holev
Developer Last Online: Jul 2006
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 think george also has a great idea about logging how many times the user has been warned of breaking the rules so that on a large board you don't have to guess or remember if it was the first or third time.