forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 permissions => Topic started by: E. William on December 07, 2013, 09:30:16 am

Title: Showing private albums, but not "Me Only" albums without a password.
Post by: E. William on December 07, 2013, 09:30:16 am
As always I've been messing around with the code, but can't get it to work.

I'd like to have Show private album icon to unlogged user on, but still hide private albums which have no password set.
So it should only show:

Public albums (obviously :))
Group Access albums
Private Albums with password protection

Where and how would I be able to code this?

Thanks for you help :)
Title: Re: Showing private albums, but not "Me Only" albums without a password.
Post by: Αndré on December 09, 2013, 12:10:28 pm
Open index.php, find
Code: [Select]
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        //unused code {SaWey}
        //$pic_filter = ' ' . $FORBIDDEN_SET;
    }
and replace with
Code: [Select]
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        //unused code {SaWey}
        //$pic_filter = ' ' . $FORBIDDEN_SET;
    } elseif (!empty($FORBIDDEN_SET)) {
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT);
        while ($row = mysql_fetch_assoc($result)) {
            $tmp_array[] = $row['aid'];
        }
        mysql_free_result($result);
        if ($tmp_array) {
            $album_filter = " AND a.aid NOT IN (" . implode(', ', $tmp_array) . ') ';
        }
       
    }
Title: Re: Showing private albums, but not "Me Only" albums without a password.
Post by: E. William on December 11, 2013, 08:33:22 am
Thanks for this Andre.

It works as that it does show albums listed in groups, but still hides private albums with password protection.

I tried changing the line:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT);

to:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT." OR alb_password != NULL");
and variations of NULL like \"\" and 0, but to no avail. It still hides password protected albums.

Any idea how I can get password protected albums to show as well?
Title: Re: Showing private albums, but not "Me Only" albums without a password.
Post by: E. William on December 11, 2013, 08:51:10 am
Never mind :)

I screwed up.

Changed the line to:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT." AND alb_password = \"\"");

And now it works perfectly :).
Thanks for helping me in the right direction. You are a king :).