PDA

View Full Version : PM+Email Warning For User


holev
01 Dec 2001, 17:25
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:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



then I opened up 'user.php' and right above this line of code (near line 200):


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


I added:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Ran This SQL command:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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]

Reaver
03 Dec 2001, 11:27
Looks like a very effective hack. Would be of great use on my site.

Thanks for your work on it.

Dark Blaze
03 Dec 2001, 17:43
Nice idea for a hack, I needed a similar kind of hack :)

Thanks lots :)

GeorgeofCS
04 Dec 2001, 12:29
Is there any way of adding something that will track each of this resaons? Like how many times the person has been warned about each?

VirtueTech
10 Dec 2001, 22:48
First off this is a great idea.

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.

This hack is a good start :)

holev
11 Dec 2001, 18:22
I agree, good idea.
will start working on it asap.

// EDIT: hack updated

inetd
23 Dec 2001, 20:22
Make please so that it was possible to do make warning with board, and not just from Admin CP.

Lucky
02 Jan 2002, 11:38
All works good with this hack.

Although I am curious as to when you ban a user it puts them in the coppa (awaiting moderation) instead of Banned by moderators or such?

So infact when you ban a user they are made a coppa user.
Any ideas?

risestar
02 Jan 2002, 13:31
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.

Lucky
02 Jan 2002, 21:34
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.

So what exactly did you change what to read what?

TheMann
02 Jan 2002, 21:41
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

risestar
03 Jan 2002, 02:34
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)."',".time().",'1','0',0,0)");
mail($toemail,$bannedtl,$bannedmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
echo "User Altered To Need to Read Status and Email sent.";

Lucky
03 Jan 2002, 06:21
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:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



So do you see anything wrong in the above?
TIA

risestar
03 Jan 2002, 06:32
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)."',".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";
}
?>
-----------

Lucky
03 Jan 2002, 09:11
Got her.

Thanx.

DelusionalMind
05 Jan 2002, 09:51
nice :)

gonna come in handy on my board

thanks :)

holev
11 Jan 2002, 10:42
sorry for not beeing here to maintain this hack.
hack updated and fixed.. thanks for your feedback.

Originally posted by inetd
Make please so that it was possible to do make warning with board, and not just from Admin CP.

thats more of a template edit..
just edit your 'postbit' templete with the link of the warnuser with propper vars attached.

TheMann
31 Jan 2002, 21:54
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.

Could you explain how a mod or admin can do this from the board. What are the variables and how do you put that in there?


Please Help

X-Fan
25 Feb 2002, 01:23
I'd like to see this enabled for mods as well in the Moderator's admin CP, if that's at all possible.

X-Fan
27 Feb 2002, 03:53
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.

That's how it looks in my warnuser.php file, but I'm still getting the PM instead of the user.

Anyone have any idea why it's doing that? This is a feature I really need on my board, so any help will be greatly appreciated!!!

Allstar DC
25 May 2002, 15:32
is it also possible to undo the warnings?

like when you want to give that user a second chance?

so, bring the warnings back to 0

Joshua Clinard
28 May 2002, 20:40
I too would like to ba able to add this to the moderators CP. Does anyone know how to do this?

inetd
05 Jun 2002, 20:16
Why this hack in beta forum?

X-Fan
15 Jun 2002, 15:01
Still waiting on an answer regarding the person issuing the warning getting the PM instead of the person being warned.

Also, whether it's possible to enable this in the Moderator CP?

And I'd also like to see the ability to remove warnings from those that have since "redeemed" themselves.

Zcyllah
04 Jul 2002, 09:14
X-fan, this was answered already by risestar on the first page. :)

BlackxRam
02 Nov 2003, 06:07
Any word on if this hack will have an option to remove one or ALL warnings?

Can this hack be added to the MODCP? I think we can just add it to the user file in the MODCP..and it would work.

Is there a way to show HOW many warnings a person has in the profile or postbit? This hack could be one of the GREAT ones, but there is little support behind it. I SUPPORT IT 100%. Lets get this moving.