How to make albums visible to 'Me only' by default How to make albums visible to 'Me only' by default
 

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

Main Menu

How to make albums visible to 'Me only' by default

Started by shaddy, August 04, 2004, 12:59:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shaddy

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

Nibbler

delete.php:

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


change to:

$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) . "')";

shaddy

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

Casper

#3
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.
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

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

Open modifyalb.php, and find this code;

<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;

  <!-- <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>-->
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

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

Casper

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


    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;

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;
}
}
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

#7
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

Casper

Have you made any other changes, as I have double checked and tested this on my test stable install, and it works without error.
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

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.

Nibbler

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

    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;
                }
        }
    }

Casper

Can you make a copy of your modifyalb.php (renamed modifyalb.txt) and post it here, and I'll compare with mine.
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

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]

Casper

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


Casper

Which means the problem is not with my hack.

Have you done a full checkout of the latest stable files from the cvs?
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

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

shaddy

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

Nibbler

Fantastico causes more problems than it solves.  ::)

Joachim Müller

@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