Creating a Ban Group Creating a Ban Group
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Creating a Ban Group

Started by pftq, January 15, 2008, 02:19:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pftq

Hi, I'm trying to edit my gallery so that it will display the banned user page if the user is part of a certain group.

My plan here is to detect the User's group id and then either let it pass or redirect to a page with the appropriate message.

However, I'm curious if there is a better way to do this.  Also, which function should this be placed in (assuming I'm making the change in my theme.php file).  Is there a function I can load to display the ban message instead?

Better yet - where is the ban function? It'd be much cleaner to simply add the group to the possible list of conditions.

Much thanks! :)

pftq

Hmm, don't mean to bump.

Simplifying my request then - basically where is the file that controls the banning? I would like to add a few extra conditions (ie banning if member is also part of x group).

Nibbler

Bans are configured in banning.php and checked in include/init.inc.php. Searching the code for TABLE_BANNED will tell you all you need to know about banning.

pftq

Excellent thank you!

For those curious, this is the code I used (copied from the original init.inc.php):

(insert into the end of init.inc.php - or anywhere really as long as it is read before headers are sent)

if(array_keys($USER_DATA['groups'], ###)||array_keys($USER_DATA['groups'], ###)) {
   pageheader($lang_error);
   msg_box($lang_info, $lang_errors['banned']);
   pagefooter();
   exit;
}

### would be the id of the user group.  You can also make plenty other conditions.  Thankfully the ban code is pretty short and not too much to copy-paste. :)