Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Showing private albums, but not "Me Only" albums without a password.  (Read 4981 times)

0 Members and 1 Guest are viewing this topic.

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #1 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) . ') ';
        }
       
    }
Logged

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #2 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?
Logged

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #3 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 :).
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 20 queries.