forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Permissions & Access Rights => Topic started by: shaddy on August 04, 2004, 12:59:05 am

Title: How to make albums visible to 'Me only' by default
Post by: shaddy 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
Title: Re: I don´t want to show all galleries..
Post by: Nibbler 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) . "')";
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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.
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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>-->
Title: Re: How to prevent certain groups from making albums visible?
Post by: shaddy 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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;
}
}
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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.
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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.
Title: Re: How to make albums visible to 'Me only' by default
Post by: Nibbler 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;
                }
        }
    }
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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.
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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]
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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. 
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy on August 05, 2004, 12:59:02 am
Yes, that's the one that's running right now.
Title: Re: How to make albums visible to 'Me only' by default
Post by: Casper 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?
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: shaddy 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: Nibbler on August 06, 2004, 03:03:45 pm
Fantastico causes more problems than it solves.  ::)
Title: Re: How to make albums visible to 'Me only' by default
Post by: Joachim Müller 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
Title: Re: How to make albums visible to 'Me only' by default
Post by: mayona on September 22, 2004, 01:39:48 am
-edited-
Title: Re: How to make albums visible to 'Me only' by default
Post by: jadsy2k on January 10, 2005, 08:54:35 pm
hi - i've recently tried to use the original mod to chang the default permission, but when applied, after creating an album, i just get 'There was an error while processing a database query' critical error. any ideas how to solve it? I'm running the latest version of CPG.
thanks for any help!
Title: Re: How to make albums visible to 'Me only' by default
Post by: Nibbler on January 10, 2005, 08:56:06 pm
Enable debug mode and post the real mysql error message.
Title: Re: How to make albums visible to 'Me only' by default
Post by: jadsy2k on January 10, 2005, 09:28:40 pm
thanks again for helping me out!

the SQL message reads

While executing query "INSERT INTO cpg_albums (category, title, uploads, pos, visibility) VALUES ('10007', 'test', 'NO',Ê '102', '10007')" on 0

mySQL error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ''102', '10007')' at line 1
Title: Re: How to make albums visible to 'Me only' by default
Post by: Nibbler on January 10, 2005, 09:29:36 pm
Erm, try removing the Ê ?
Title: Re: I don´t want to show all galleries..
Post by: jadsy2k on January 10, 2005, 10:04:03 pm
success! looks like when i saved the file, it had encoded it differently using a different character set and had been putting in the extra characters. I have checked it again and resaved it and all is now working. thanks!