Showing private albums, but not "Me Only" albums without a password. Showing private albums, but not "Me Only" albums without a password.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Showing private albums, but not "Me Only" albums without a password.

Started by E. William, December 07, 2013, 09:30:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

E. William

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 :)

ΑndrĂ©

Open index.php, find
    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
    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) . ') ';
        }
       
    }

E. William

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?

E. William

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 :).