I am working on a website comissioned by a video production team. One of their requirments is to build a private page for their clients which should behave like this:
- the "Clients" menu entry should be visible only for logged on users --- I solved this one.
- each client should have it's own user and pass which gives him access to his own albums --- I created a user "client-1" with "post comments" and "upload" rights and I flagged "client-1" top level album at managed albums.
- nobody else except the client and admin can view it's private album --- This one gives me headakes because I don't know how to display only his managed albums for a logged on client.
I think that one way to do this is to clone the gallery.php page, rename it clients.php and alter the script inside using the isMyAlbum() function to display only the managed albums. The trouble is that I can't figure on my own how to write the php code corectly.
Another issue with this aproach is that the private albums will be accesible by url. One fix would be to password protect the albums but that would mean that the user has to log on twice to see the contents of his album.
Using only album password protection and having to send each client a link to his album has been ruled out by my client.
Thanks for your help!
Comments
Since you have to use toplevel albums to be able to protect theme, make one top level album that contains the public ones as subalbums (as the publich portfolio for example.).
Now add a check on the album.php theme page to allow only the portfolio album and its subalbums to be accessible.
For the private ones use the clients.php page. Since that is not a standard album page they albums will not be accessible. There put a next_album() loop within the isMyAlbum() checks so that only albums the current logged in client is allowed to see are displayed. I did this for a site as well:
`
<?php if(!zp_loggedin()) printPasswordForm(); ?> // so the user gets a login form
<?php while (next_album()): ?>
<?php if(isMyAlbum($_zp_current_album->name,ALBUM_RIGHTS) && $_zp_current_album->name != "slideshow" && $_zp_current_album->name != "gallery" ) { ?
>
(Do your display here)
<?php endwhile; ?>
`
The checks for the slideshow/gallery albums are examples you need to change to exclude the publich albums from this page. Best you use the `getUrAlbum` function to globally exclude all subalbums of the public top level album.
See also http://www.zenphoto.org/2009/03/troubleshooting-zenphoto/#46
EDIT:
I've forgot one thing... Which condition should I use to print the comment block only for images located in the clients folder. I have moved the public portofolio in a top level album named "gallery". I guess I should write something like this:
if ($main_album!='gallery')
echo 'comment block code';
You can also make your own image.php page by just passing the name of the album and image to a custom page and then using hte object model.