Protected album title

I'd normally make a search but it's not working at the moment. I wanted to know if it's possible to change the title of the album if the album is protected. As in, if the album has a password display 'Protected album' as its title and then after the user has logged in display the regular album name.

Comments

  • Certainly, Of course you will have to code the display. The functions you want are `isProtectedAlbum($album)` and `zp_loggedin()`.
  • Thanks! I'm almost there.

    `
    <?php
    if (isProtectedAlbum()) {
    echo "Protected album";
    }
    else if (zp_loggedin()) { ?>
    " title="<?php echo gettext('View album:'); ?> <?php echo getAnnotatedAlbumTitle();?>"><?php printAlbumTitle(); ?>
    <?php } ?>
    `
    At the moment if the user is not logged in it prints 'protected album' but I don't have titles for the other albums.
    If the user is logged in I can see the titles but the protected album still says 'protected'

    @Jimania No search engine objective. I need too share some photos with selected people only. These people know already which photos they will find inside the album, the others don't need to know the nature of the content, hence the name mask. :)

    EDIT: I added `<?php if (isProtectedAlbum() AND !zp_loggedin()) {` so problem #2 is solved, but I'm still having problems with #1.
    I added the album name `if (isProtectedAlbum(nameofmyalbum))` but it's Fatal error: Call to a member function getPassword() on a non-object in ...\photos\zp-core\template-functions.php on line 4254
  • acrylian Administrator, Developer
    An album is still an protected album if you are loggedin, so `isProtectedAlbum()` is true even then.

    Note that the album name for a subalbum includes the parent albums as well ("toplevel/sublevel1/sublevel2"....).

    PS: I think the jimania post might be spam...
  • What the...? You're right, the account is just a few hours old. It looked like a genuine message. <_<

    Ok, so adding the right album name is the solution? I'm asking cause I was going by tentatives, I don't really know if what I'm doing is correct.

    Anyway, it's a toplevel album. The url is site.com/gallery/album so I put 'album' but it doesn't work either way,'gallery/album' fails too.
  • acrylian Administrator, Developer
    Where exactly do you put that code? (no idea about the fatal error right now).
  • Here, I replaced everything inside h3. I'm using a fresh install of 1.3 and testing it with the default theme.
  • If you are passing an album, it must be an album object, not the name. If you omit the parameter it will check the currernt album.

    So, it would seem to me what you want is:

    if (!zp_loggedin() && isProtectedAlbunm()) {echo "protected album"; } else { output the normal stuff }
  • sbillard ++. Thank you! One day I swear I'll get the hang of php. :p
  • Acrylian... You are a genius!!
Sign In or Register to comment.