vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   PM+Email Warning For User (https://vborg.vbsupport.ru/showthread.php?t=32856)

holev 11-30-2001 10:00 PM

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]

Reaver 12-03-2001 09:27 AM

Looks like a very effective hack. Would be of great use on my site.

Thanks for your work on it.

Dark Blaze 12-03-2001 03:43 PM

Nice idea for a hack, I needed a similar kind of hack :)

Thanks lots :)

GeorgeofCS 12-04-2001 10:29 AM

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 12-10-2001 08:48 PM

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 12-11-2001 04:22 PM

I agree, good idea.
will start working on it asap.

// EDIT: hack updated

inetd 12-23-2001 06:22 PM

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

Lucky 01-02-2002 09:38 AM

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 01-02-2002 11:31 AM

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 01-02-2002 07:34 PM

[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.


All times are GMT. The time now is 08:09 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.01225 seconds
  • Memory Usage 1,770KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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