how to hide albums (folders) with no images?

I have some folders with no images (either no files, or files do not contain images). Is there a way to tell zenphoto to hide these albums (with the need for me to manually mark each album)? Right now, they show a big question mark image.

Thanks...

-- Jeff

Comments

  • acrylian Administrator, Developer
    The easiest way is to manually unpublish these albums. All other solutions would require coding.
  • Thanks for your response. I will think about whether this is important enough for me to go diving into the code.
  • acrylian Administrator, Developer
    Another idea: You could use the scheduled content utility to set "unpublished" as default. Then of course you need to manually publish the other albums.
  • I had the same problem and fixed it like that (a bit ugly though):

    gallery.php (line 39, ../themefolder/):
    if(getNumImages() == 0)
    {
    continue;
    }

    print_album_menu.php (line 212, ../zp_core/zp_extensions/):
    if($topalbum->getNumImages() == 0)
    {
    continue;
    }

    This is because I want people to register to see photos, let them have their own album to upload, but NOT have empty albums shown on home/. You need to alter both files, because the sidebar is using the printAlbumMenu() function, while the gallery.php is looping through albums on its own.
    Well as I said, not the prettiest solution, but works for my purposes!
  • acrylian Administrator, Developer
    It is of course not recommend to hack plugins. The best solution would be to use the object model to check the albums for images and then set them unpublished using the theme head filter.
  • @acrylian
    Where can i read more on how to change such things with filters? I couldn't find anything in the docs... Well, i found the filter file and a description, but... err, well that didn't explain much imo.
    ty :)
  • acrylian Administrator, Developer
    You find all info on the user guide:
    http://www.zenphoto.org/news/category/development

    Of course you first should get familiar with Zenphoto and its themes itself.
  • I managed to write a plugin that hooks to the theme_body_open filter of the zenpage theme. It unpublishes albums with no images AND no subalbums in it.

    Thank you so far for the help acrylian.

    Because life would be boring without 2 new problems with every solved one:
    I didn't know, that unpublished albums are shown to logged in users. Every viewer on my page has to be registerd and logged in (that is, because this gallery will be for a private userbase only). So there is problem 1.

    Problem 2 is: I reimplemented the hack (now with proper syntax), which now works for the gallery.php and print_album_menu.php (->sidebar links) file. I don't know however how to change the pagination to stop showing empty sites.

    If anybody is interested in the unpublish_album_plugin: its documented and ready to use. let me know :)
  • acrylian Administrator, Developer
    Problem 1: Well, it is default behaviour of Zenphoto that unpublished and even protected items are shown to users on the front end who have the appropiate rights. There is a plugin "show_not_logged-in" included to avoid that.

    Problem 2: See 1..:-)

    We appreciate every 3rd party plugin or else contribution. Please read here:
    http://www.zenphoto.org/news/general-contributor-guidelines#themes-and-plugins
    We then glady add an entry on the extensions section for it.
  • The show_not_logged-in plugin will not work in this case. That plugin really makes the user "not logged-in" in all senses of that state, so managed albums, etc. would not apply.

    There is a change made in tonight's development build which may solve the problem or you. Currently there is a managed album sub-right for viewing unpulished images. That is now extended to include subalbums as well. In addition, the "default" gallery behavior will be that unpublished albums do not display for users without the view all albums right.
  • @acrylian okay great, I will read through the guidelines and commit the plugin!

    Unfortunately, the show_not_logged_in-plugin does not help in my case. As sbillard said, it would only let me see the login screen and thats it (of course that only applies to our zenfoto-site).

    About the nightly-build: thats music to my ears, I'll definetly update. I thought it would be bad to to view the gallery as an admin then (because you'd have to switch through hundreds of empty albums), but I'll just make another normal user for viewing/uploading tasks. And that is probably recommended anyway.
  • I have made a quick documentation of how things will work as part of the 1.4.2 announcement (currrently not published.) The direct link to this document is http://www.zenphoto.org/index.php?p=news&title=zenphoto-1.4.2

    We will appreciate your testing this feature and reporting any issues.
  • I published the plugin in the plugin section of the forum. Please let me know if there is anything you want me to change or add.

    The new version (nightly build: zenphotoV1.4.2-DEV) works like a dream, the plugin also performs as expected. Unpublished albums are now only visible to users with the "manage all albums" permission.

    The jplayer is also a really great addition :)
Sign In or Register to comment.