Advanced search  

News:

cpg1.5.20 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.18 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Hide Empty Categories  (Read 3562 times)

nickelas and 1 Guest are viewing this topic.

1aB

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Posts: 28
    • Home Page
Hide Empty Categories
« on: December 31, 2010, 05:23:50 pm »

Hi all,

I just implemented this as a plugin:

Hide Empty Categories cleans up the category list on the thumbnail pages by hiding those categories that are empty, regardless whether they really are empty or whether the current user just sees them as empty. Benefit is to avoid end-user confusion with empty categories when they do not have access to anything within them.

Potentially this plugin may conflict with themes that customize theme_display_cat_list(), as that is what I actually customized... well... left out from. Hope the implementation is clean enough.

Roland


Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 11910
Re: Hide Empty Categories
« Reply #1 on: December 31, 2010, 05:45:32 pm »

Well done. Am I right that the modification is to comment out
Code: [Select]
           $params = array(
                    '{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                    '{CAT_DESC}' => $category[1],
            );
            echo template_eval($template_noalb, $params);
?

If so, I'd suggest to add a new plugin hook (actually a hidden config value should be enough). That way this plugin works for all themes.


Moving thread to plugin contributions board.


I'll add the plugin to the download section and to the plugin page later.
Logged

1aB

  • Contributor
  • Coppermine novice
  • ***
  • Country: de
  • Offline Offline
  • Posts: 28
    • Home Page
Re: Hide Empty Categories
« Reply #2 on: December 31, 2010, 07:01:02 pm »

Right, it strictly speaking consists only of leaving out the commented part. All the rest is original Coppermine code.
Indeed the modification is so minimal that it could also be a mainstream config option.

About plugin hooks, I suppose that makes sense, because I was acutally searching for which of the hooks I would need to utilize for this, just to spot that there wasn't one... ;-)
Logged

Cyrolancer

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 25
Re: Hide Empty Categories
« Reply #3 on: May 17, 2012, 01:03:39 pm »

Just commenting out

Code: [Select]
echo template_eval($template_noalb, $params);

part seems working to me.
Logged

StuartDowling

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Hide Empty Categories
« Reply #4 on: April 30, 2013, 05:48:46 pm »

That plugin worked a treat - thank you  :)
Logged

AK_CCM

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 57
  • Mushroom Hobby Photograph
    • My fungi-pictures on fotocommunity.de
Re: Hide Empty Categories
« Reply #5 on: Yesterday at 01:38:50 pm »

The plugin works very well - thanks for contributing. It would be great if any further version displays empty categories which contains subcategories. Because I'm using some nested categories and now the parent categories are hidden.

Regards, Andreas
Logged
Pages: [1]   Go Up
 

Page created in 0.161 seconds with 22 queries.