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: Private Categories / Sub Albums  (Read 6835 times)

0 Members and 1 Guest are viewing this topic.

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Private Categories / Sub Albums
« on: May 09, 2012, 02:27:09 pm »

Hello,

I am working on CPG 1.5.20. I am trying to make private categories or sub albums. It seems it is not possible right now (or possible?).

I have thought that if creating private categories or sub albums is not possible, maybe somehow it is possible to set visibility of some categories only to the users that are logged in (Guests should see some of the categories).

Can you please guide me how to do such addition to CPG? I couldn't find where to start, what file to look for this addition.

Thanks a lot.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Private Categories / Sub Albums
« Reply #1 on: May 09, 2012, 02:43:45 pm »

It's not that easy. If you hide categories and/or albums, pictures can still be accessed through the meta albums or by directly visiting the album's thumbnail page or the picture's intermediate-sized pages.
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Private Categories / Sub Albums
« Reply #2 on: May 09, 2012, 10:36:57 pm »

Let me explain a little bit.

I have 2 different categories and several sub categories inside them. In one category, Cat A, I made hidden all albums to guests. In the other one, Cat B, everything is visible.

The thing is I am working on a solution that the category Cat A will become invisible to guests, just invisible. In any way you enter the category as guest, you won't see any of the albums or the images inside the albums because they are already set invisible to guests by CPG permission settings.

It is like; if category_id = 5 (Cat A), don't show to guests. Just don't show. If the guest can find the way to enter that category, he won't be seeing anything due to CPG permissions.

I am not trying to add any category permissions right now. Just want to remove one category from the main page lists. But  category permissions can be a good feature for the next releases. :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Private Categories / Sub Albums
« Reply #3 on: May 10, 2012, 09:13:03 am »

In one category, Cat A, I made hidden all albums to guests.
If everything is hidden, it is empty for guests, right? If so, use this plugin: http://forum.coppermine-gallery.net/index.php/topic,69444.0.html
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Re: Private Categories / Sub Albums
« Reply #4 on: May 10, 2012, 11:41:18 am »

If everything is hidden, it is empty for guests, right?

That is correct. I will try the plugin and then share the results. Hope it works in CPG 1.5.20.
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Private Categories / Sub Albums
« Reply #5 on: May 10, 2012, 03:39:35 pm »

The plugin works perfectly in CPG 1.5.20. Thanks Αndré.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Private Categories / Sub Albums
« Reply #6 on: May 10, 2012, 06:36:15 pm »

Please
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Private Categories / Sub Albums
« Reply #7 on: May 16, 2012, 10:57:37 pm »

Thanks for the tip André.

I have very small question to ask. Is it possible to determine which category is hidden by using the code? Tried some changes but I couldn't manage to handle it. Any tips or suggestions about this topic also appreciated.
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Private Categories / Sub Albums
« Reply #8 on: May 18, 2012, 07:52:25 pm »

I have managed to find empty categories. In the function theme_display_cat_list(), there is a $cat_data array. This returns the categories in its first dimension and the category information in its second dimension. If the second dimension of the array returns 3 elements, it means that category is empty. Sample code is below. You can add it anywhere you like in theme_display_cat_list() function.

Code: [Select]
foreach ($cat_data as $cd) {
    if(count($cd) == 3)
        // Category is empty.
    else
        // Category is not empty.
}
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.