Private albums visible only for the logged on user which manages it

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

  • acrylian Administrator, Developer
    The clients.php is the right way. I suggest the following to divide the public ones from the none public ones.

    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.
  • - 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.

    The ONLY way to accomplish this is to password protect the album.
    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.

    I must not understand this. The user will not have to provide the album password as he will already be logged in with his user/password and be allowed access via the managed albums settings. But anyone else would need to know the password to access the album.

    See also http://www.zenphoto.org/2009/03/troubleshooting-zenphoto/#46
  • Didn't know about that. Well, it seems all my problems are solved. Thanks for your good advice! I'll be posting the site in the showcase soon!

    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';
  • acrylian Administrator, Developer
    I think that is a good way. The client site I made did not use an image.php at all but colorbox to show the images. That way I did not need to worry about image.php andcomments (the site that sadly never went live did not use comments at all though).

    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.
  • I'm a bit confused at how exactly I should write the code. I'm quite novice at php classes. I'd be gratefull if you would help me to write it corectly :D
  • acrylian Administrator, Developer
    Please review the object model tutorial and refer to general php resources on the net first. You will surely understand we don't have the resource to teach that here.
Sign In or Register to comment.