Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Creating a Ban Group  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Creating a Ban Group
« 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! :)
« Last Edit: January 25, 2008, 09:29:33 am by Joachim Müller »
Logged

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Re: Creating a Ban Group
« Reply #1 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).
Logged

Nibbler

  • Guest
Re: Creating a Ban Group
« Reply #2 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.
Logged

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Re: Creating a Ban Group
« Reply #3 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. :)
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.