coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: Cyrolancer on May 09, 2012, 02:27:09 PM

Title: Private Categories / Sub Albums
Post by: Cyrolancer 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.
Title: Re: Private Categories / Sub Albums
Post by: Αndré 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.
Title: Re: Private Categories / Sub Albums
Post by: Cyrolancer 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. :)
Title: Re: Private Categories / Sub Albums
Post by: Αndré on May 10, 2012, 09:13:03 AM
Quote from: Cyrolancer on May 09, 2012, 10:36:57 PM
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
Title: Re: Re: Private Categories / Sub Albums
Post by: Cyrolancer on May 10, 2012, 11:41:18 AM
Quote from: Αndré on May 10, 2012, 09:13:03 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.
Title: Re: Private Categories / Sub Albums
Post by: Cyrolancer on May 10, 2012, 03:39:35 PM
The plugin works perfectly in CPG 1.5.20. Thanks Αndré.
Title: Re: Private Categories / Sub Albums
Post by: Αndré on May 10, 2012, 06:36:15 PM
Please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
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.
Title: Re: Private Categories / Sub Albums
Post by: Cyrolancer 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.
Title: Re: Private Categories / Sub Albums
Post by: Cyrolancer 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.


foreach ($cat_data as $cd) {
    if(count($cd) == 3)
        // Category is empty.
    else
        // Category is not empty.
}