The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Ban a user based on a string contained
in the post or signature? I want to ban a user automatically, based on the presence of a particular text string contained in the post or sig. I'll code it myself (even though PHP isn't among my languages) but I need a hint 1st. Where would such a function best be placed? Which file(s)? Would it be in the showthread template ? Or New Thread/reply? Thanks for any clues.
Here's the compound if I have so far: if (strpos($post[message], "Blah") !== false)&&(strpos($post[message], "BlahBlah")!==false)&&(!can_moderate($thread['forumid'], 'caneditthreads') && (!can_moderate($thread['forumid'], 'caneditposts')) Is there a simpler way of testing usergroup? Something like $bbuserinfo[$usergroup] or something along those lines? Thanks for any help Ok, I found the easier method to test for usergroup: $bbuserinfo['usergroupid']; Now what I need is the working statement. How does one change usegroup? Is it anything like $vbulletin->userinfo['usergroupid']=8; //that? |
#2
|
|||
|
|||
Is this any closer?
if (strpos($post[signature], "Blah") !== false)&&(strpos($post[signature], "BlahBlah")!==false)&&($bbuserinfo['usergroupid']!=0)&&($bbuserinfo['usergroupid']!=1)&&($bbuserinfo['usergroupid']!=2) { $db->query_write("UPDATE user SET usergroup = 'bannedID#' WHERE userid=postuserid"); } |
#3
|
||||
|
||||
You're getting there with the second one... the query is close, but I think the end should be:
Code:
if (strpos($post[signature], "Blah")&&strpos($post[signature], "BlahBlah")) { $db->query_write("UPDATE user SET usergroup = 'bannedID#' WHERE userid=".$post['userid']); } Code:
if (strpos($post[signature], "Blah")||strpos($post[signature], "BlahBlah")) { $db->query_write("UPDATE user SET usergroup = 'bannedID#' WHERE userid=".$post['userid']); } |
#4
|
|||
|
|||
Oh thanks, I was beginning to think I had bad breath or something . Yes, I know it's an AND and that's what I need. Either string might be present in the sig of someone I don't wish to auto-ban. Only 1 party should have both. I test for them separately just in case something is between them.
I'll probably omit the usergroup tests. That was just to be sure that mod, supers, and admin groups would be exempted, but there's no way they'd have all the strings I'll test for in their sigs. No one will except the user I want to ban. Thanks LOADS man, this is my 1st attempt at writing anything in PHP. Based on what you've shown me, I'm probably just going to test for the presence of 3 strings (with ANDs) and omit the other tests. Thanks again. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|