ZenphotoCMS Forum
getAlbums not working as expected - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: getAlbums not working as expected (/thread-11592.html)



getAlbums not working as expected - pju_photo - 2014-01-21

Hello,

when trying to get the names of all existing albums I tried this:
$_zp_gallery->getAlbums(0,null,null,true,true)
expecting to get both published and unpublished albums. I only get published albums though. Tried setting the last param ($mine) to false as well, without success.

Is that correct behaviour? How would I get a list that includes unpublished albums?

Quick note: tried some stuff in class-gallery and it seems that it's the sortAlbumArray function that doesn't return the unpublished albums, no matter how you set $mine.

Thanks for your help.




getAlbums not working as expected - acrylian - 2014-01-21

Works for me as intended with lastest 1.4.5.8 support build. Note it of course only returns the top level albums for sub albums you have to use further object model methods of the album class.




getAlbums not working as expected - pju_photo - 2014-01-23

Strange, as that's the version I'm working with and I'm talking about top level albums. I thought it might be a plugin interfering, but that didn't change anything.

So just to be sure, $_zp_gallery->getAlbums(0,null,null,true,true) should return a list of ALL albums, whether published or not, no matter if I'm logged in or not?

Sorry for bugging you about this.




getAlbums not working as expected - acrylian - 2014-01-23

Yes, that it is supposed to do and did for me when I tested.




getAlbums not working as expected - pju_photo - 2014-01-24

Okay, I found out that after I call the template functions getNextAlbum or getPrevAlbum the gallery class function getAlbums will only return published albums, no matter how you set the $mine parameter.
Is that intended behaviour or should I file a bug report? It's a small thing, but can be quite annoying because it's so unexpected.




getAlbums not working as expected - acrylian - 2014-01-24

Best you indeed open a ticket with the exact description of what you do how. Be sure to use the lastest 1.4.5.9 just released.




getAlbums not working as expected - pju_photo - 2014-01-26

Seems I was mistaken in my experimenting. I just tried again and the problem actually seems to be that when you call getAlbums on $_zp_gallery once either without parameters or with $mine set to false, subsequent calls (with $mine set to true) return only the filtered (published) entries.
I opened a ticket describing that. Thanks!