coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: pftq on January 15, 2008, 02:19:10 AM

Title: Creating a Ban Group
Post by: pftq on January 15, 2008, 02:19:10 AM
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! :)
Title: Re: Creating a Ban Group
Post by: pftq on January 17, 2008, 05:32:44 AM
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).
Title: Re: Creating a Ban Group
Post by: Nibbler on January 17, 2008, 11:08:29 AM
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.
Title: Re: Creating a Ban Group
Post by: pftq on January 24, 2008, 11:58:34 PM
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. :)