Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: How to make albums visible to 'Me only' by default  (Read 11898 times)

0 Members and 1 Guest are viewing this topic.

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
How to make albums visible to 'Me only' by default
« on: August 04, 2004, 12:59:05 am »

Is there a way to make it default to 'Album can be viewed by' = Owner Only?  As in, for each new registered user, their album wouldn't be visible to anyone else?

I know you wouldn't noramlly want that, but it's how I want it. 

Thanks
SHaddy
Logged

Nibbler

  • Guest
Re: I don´t want to show all galleries..
« Reply #1 on: August 04, 2004, 02:20:03 am »

delete.php:

Code: [Select]
$query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos) VALUES ('$category', '" . addslashes($op['album_nm']) . "', 'NO',  '{$op['album_sort']}')";
                   

change to:

Code: [Select]
$query = "INSERT INTO {$CONFIG['TABLE_ALBUMS']} (category, title, uploads, pos, visibility) VALUES ('$category', '" . addslashes($op['album_nm']) . "', 'NO',  '{$op['album_sort']}', '" . (FIRST_USER_CAT + USER_ID) . "')";
Logged

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #2 on: August 04, 2004, 04:31:47 am »

That did the trick (as you knew it would  ;)  )

Now how do I make it so they can't change it manually?  I can still log in as a regular registered user, and enter Admin mode, then make that ' Album can be viewed by' = Everybody.

I only want them to be able to see the pics (and me, the Admin), no one else.

This, as you can tell, isn't going to be a standard gallery, I'll explain more fully if you want. 

Thanks for your help, I'm unsure if this needs to be in a new thread, since it's so closly related to the first Q.
Shaddy
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #3 on: August 04, 2004, 08:49:56 am »

The selection box to change visibility is only visible if 'users can have private albums' is set to yes in config.So setting it to no should remove this ability.
I don't know if this will work with your altered setup though.


EDIT.  I must still have been asleep when I wrote that.  Doing that will automatically make all albums visible to all viewers, sorry.
« Last Edit: August 04, 2004, 10:15:59 am by Casper »
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #4 on: August 04, 2004, 10:24:35 am »

OK, here's the correct way to do it (I think).

Open modifyalb.php, and find this code;

Code: [Select]
<tr>
                <td class="tableb">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <select name="$name" class="listbox">

EOT;
    foreach ($options as $value => $caption) {
        echo '                                <option value ="' . $value . '"' . ($ALBUM_DATA['visibility'] == $value ? ' selected': '') . '>' . $caption . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

And replace it with this code;

Code: [Select]
  <!-- <tr>
                <td class="tableb">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <select name="$name" class="listbox">

EOT;
    foreach ($options as $value => $caption) {
        echo '                                <option value ="' . $value . '"' . ($ALBUM_DATA['visibility'] == $value ? ' selected': '') . '>' . $caption . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>-->
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to prevent certain groups from making albums visible?
« Reply #5 on: August 04, 2004, 03:45:47 pm »

Thanks, that worked.  I'd like to make it even more complicated now (really sorry, I do appreciate your help)...

I'd like certain groups (like a group named 'Friends') to have their albums visible to others named as friends.  But the default registered user have their albums only visible to them (Me Only).

The reason...  I'm not wanting to turn this into a regular picture hosting site.  My main goal is to supplement an existing forum board, by allowing them to upload pics, then hotlink to them from that board.  I don't want all the users to be able to just come to my site and peruse all the photo's of other users. Although that would be nice of me, I just don't have the bandwidth to allow that.  Plus some might upload their vacation pics and tell all their family and friends to look there. 

BUT, I'd like my friends to be able to upload pics see eachothers albums. 

So is there a way to be selective (by group) on when that visibility list box is displayed?

Hopefully I explained that OK.

Thanks again
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #6 on: August 04, 2004, 09:07:53 pm »

Yes,

This hack will allow you, the admin, to see the visibility box, but no-one else.  I don't know how to allow certain other members do it, but at least you will be able to make these albums visible to your friends group.
Find this code (which in your case will have the comment marks);

Code: [Select]
    echo <<<EOT
        <tr>
                <td class="tableb">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <select name="$name" class="listbox">

EOT;
}
IF (USER_IS_ADMIN){
    foreach ($options as $value => $caption) {
        echo '                                <option value ="' . $value . '"' . ($ALBUM_DATA['visibility'] == $value ? ' selected': '') . '>' . $caption . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

EOT;
}

And replace it with this;

Code: [Select]
IF (USER_IS_ADMIN){
    echo <<<EOT
        <tr>
                <td class="tableb">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <select name="$name" class="listbox">

EOT;
}
IF (USER_IS_ADMIN){
    foreach ($options as $value => $caption) {
        echo '                                <option value ="' . $value . '"' . ($ALBUM_DATA['visibility'] == $value ? ' selected': '') . '>' . $caption . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

EOT;
}
}
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #7 on: August 04, 2004, 10:37:43 pm »

Thanks again...  It might be working   :-\\  but I'm getting this error

Warning: Invalid argument supplied for foreach() in /home/shaddy/public_html/theoak/photo/themes/water_drop/theme.php on line 1105
{edit}
Just figured out how to find the line number, and error corresponds to
     function theme_display_album_list(&$alb_list, $nbAlb, $cat, $page, $total_pages)
specifically ==>
    echo $header;

    foreach($alb_list as $album) {
        $count ++;

        $params = array('{COL_WIDTH}' => $column_width,
            '{ALBUM_TITLE}' => $album['album_title'],
            '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
            '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
            '{ALB_LINK_PIC}' => $album['thumb_pic'],
            '{ADMIN_MENU}' => $album['album_adm_menu'],
            '{ALB_DESC}' => $album['album_desc'],
            '{ALB_INFOS}' => $album['album_info'],
            );

        echo template_eval($album_cell, $params);

        if ($count % $columns == 0 && $count < count($alb_list)) {
            echo $rows_separator;
        }
    }

{end edit}

when I try to view an album when logged in as an Admin. (not 'admin mode', but as an admin).  I tried other themes, same thing.  It must have been happening before I changed the code above...  because I restored it to normal and same thing... I just hadn't tried to view another album as an admin b4 (I was just using registered users id)

THe owner can view the album (and use the Properties button), and view an 'everybody can see' album.  But when an admin tries to go to a users album, it fires the error (but the admin can see and change his own album).

Sorry for all the trouble, but unless there're some other surprises, it'll be just how I want it after this bug get's traced...

Thanks
« Last Edit: August 04, 2004, 10:48:45 pm by shaddy »
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #8 on: August 04, 2004, 11:09:44 pm »

Have you made any other changes, as I have double checked and tested this on my test stable install, and it works without error.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #9 on: August 05, 2004, 12:02:27 am »

I made changes to delete.php (as listed above) and displayimage.php (modified URL to read path to full image against GauGau's better judgement ;) ).  But I made backups of both before moding (whew, made swapping back for troubleshooting a breeze)... BUT... same problem. 

I've done a lot with the browser based config (not php stuff directly), but I doubt that would cause a prob, it probably would have shown up before now.

Since I haven't done much in the way of hacking, I might just re install and re mod one at a time to see when it shows up again, if it does.  I hate to waste more of your time. Especially if it turns out to be something I tried but aren't remembering doing right now (most likely, I'm pretty new to this).

You guys rock.
Logged

Nibbler

  • Guest
Re: How to make albums visible to 'Me only' by default
« Reply #10 on: August 05, 2004, 12:06:45 am »

There should be an is_array check around that block of code, make sure you have an up to date version of your theme.php

Code: [Select]
    echo $header;
    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
                $count ++;

                $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                );

                echo template_eval($album_cell, $params);

                if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
                }
        }
    }
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #11 on: August 05, 2004, 12:10:11 am »

Can you make a copy of your modifyalb.php (renamed modifyalb.txt) and post it here, and I'll compare with mine.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #12 on: August 05, 2004, 12:33:59 am »

Haven't attached b4, hope I did it right. 

After I dnld'd the newest theme.php (for water_drop), when the admin clicks on a users album, I don't see the error any more, but I also don't see the album.

Home > User galleries > test
(album should be here, but there's nothing)
1 albums on 1 page(s)

Am I creating more probs? 

[attachment deleted by admin]
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #13 on: August 05, 2004, 12:51:52 am »

The modifyalb you attached is the unmodified version.  Is that what you have on you server now?
If so, then obviously that's not the problem. 
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #14 on: August 05, 2004, 12:59:02 am »

Yes, that's the one that's running right now.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to make albums visible to 'Me only' by default
« Reply #15 on: August 05, 2004, 01:14:14 am »

Which means the problem is not with my hack.

Have you done a full checkout of the latest stable files from the cvs?
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #16 on: August 05, 2004, 01:28:41 am »

I backed up my mod'ed files as whateverModBAK.php, and will just do a clean install with the newest files (that I just dnld'd).  Then I'll hope everything works as default.  Then I'll add the mods one at a time while checking for the problems after each swap. 

That's probably the best way for me to do it, and I'll be sure to have all the latest stuff.

I'll reply to this when I've done it to let you know how it went.

You've all been a great help, above and beyond.  Hopefully you feel appreciated, cause you don't get this level of support with a non-open source program.  Try calling MS and ask for a mod on XP, see what happens.

Thanks again
Logged

shaddy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 23
Re: How to make albums visible to 'Me only' by default
« Reply #17 on: August 05, 2004, 07:27:05 am »

MAN...  you'd think I'd learn not to assume things at this point in my life.  I didn't have the latest version, I even think that I had files of different versions mixed together.  I used my host provided Fansastico scripting to install whatever ver of Coppermine they had, and I assumed it was the latest n greatest.  (didn't have multimedia support or multiple file uploads, now the manual makes more sense ;) )

I downloaded 1.3.1 and re installed everything, and I didn't depend on my saved modified PHP's because I didn't want to mix versions... so i just re hacked in all your previous suggestions and so far... everything seems to be working great.

I should have checked version after first error, but didn't until it was suggested, sighhhhhh.   

Anyhoo, thanks for your patience and help.  Everything seems to be in order, I'll just do a day or two of heavy experimenting with registering different users and settings to make sure I have everything where I want.

Later
Logged

Nibbler

  • Guest
Re: How to make albums visible to 'Me only' by default
« Reply #18 on: August 06, 2004, 03:03:45 pm »

Fantastico causes more problems than it solves.  ::)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to make albums visible to 'Me only' by default
« Reply #19 on: August 06, 2004, 05:17:19 pm »

@devs: I think it's about time to get in contact with the fantastico devs and talk this over. I think they should at least add a note to their version that says something like "you are not using the original coppermine software, but a customized fantastico version. Feel free to contact us for support if you are in trouble." ;)

GauGau
Logged
Pages: [1] 2   Go Up
 

Page created in 0.055 seconds with 19 queries.