Can you make the random block not display certain albums?

scooter

Joined: 2002-09-16
Posts: 10
Posted: Sun, 2002-10-06 15:07

I use gallery_random to disply my gallery pictures. I will be adding a new album to my gallery. But I do not want gallery_random block to display this album.

Is there a way to dissallow certain albums?

Thanks

 
desean84
desean84's picture

Joined: 2002-08-15
Posts: 36
Posted: Mon, 2002-10-07 06:56

this was discussed before in the Gallery-users mailing list titled "Support for specific albums within Random Photo Block". solution was provided by Joseph Lane.

Quote:
Ok, to solve your problem it's going to take a bit of editing...
All you need to do is add an if statement. So fine the first line in
the code below in your block-random.php.

Then add the if ($name != "wrench1") { <-- Now wrench1 is the name
of the directory I don't want included, this would be your guest album.
Once you add that line you need to put an end } after $cache[$name] =
$numPhotos; like shown below.

It worked for me, it *should* work for you.

$name = $tmpAlbum->fields["name"];
if ($name != "wrench1") {
if ($numPhotos > 0) {
$cache[$name] = $numPhotos;
}
}
}
}
}
?>

Joe

 
rebel2k

Joined: 2002-10-18
Posts: 39
Posted: Fri, 2003-01-03 19:43

great! but one thing does not work :sad:

I had an Album calles USER-Pics (album05), in this album are more albums wiht names of the owners (users), now if I change the block code to this

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
if ($name != "album05") {
if ($numPhotos > 0) {
$cache[$name] = $numPhotos;
</TD></TR></TABLE><!-- BBCode End -->

he didnot show the album05 but all subalbums in this album! How to get around this problem, any idea?

 
rebel2k

Joined: 2002-10-18
Posts: 39
Posted: Mon, 2003-01-06 16:49

no idea someone?

 
dodofreak
dodofreak's picture

Joined: 2002-12-09
Posts: 75
Posted: Thu, 2003-01-09 16:48
Quote:
I use gallery_random to disply my gallery pictures. I will be adding a new album to my gallery. But I do not want gallery_random block to display this album.

Is there a way to dissallow certain albums?

Thanks

One easy way is to use the PostNuke/Gallery permissions system.

If you are using the Random Block PostNuke module, you should be able to disallow random block from scanning albums you don't want to be displayed by setting the "LOGGEDIN" permissions for "Users who can see the album".

This is because Random Block scans the albums similar to an anonymous user (so it will only pick up permissions granted to "EVERYBODY").

I'm not sure if you intended to keep the permissions to "EVERYBODY", since it seems logical that if you don't want to publicly display the album in Random Block, then you probably don't want public access to the albums too.

Hope this helps.

 
Jared

Joined: 2002-09-29
Posts: 37
Posted: Tue, 2003-01-21 20:29

I just tried Joseph Lane's solution for the random block on a stand alone gallery. I edited the file and got no errors once it was uploaded. However it is still pulling images from albums that I do not want to show as random images. This album is still a public album, but this album contains graphical walkthrough help topics.

Here is the code that I am using <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> $name = $tmpAlbum->fields["name"];
if ($name != "graphics_not_used_yet") {
if ($name != "Help_Topics") {
if ($name != "Alumni_Database_Help") {
if ($name != "FTP_upload_help") {
if ($numPhotos > 0) {
$cache[$name] = $numPhotos;
}
}
}
}
}
}
}
}
?> </TD></TR></TABLE><!-- BBCode End -->

Any suggestions?

Thanks

 
in10ct
in10ct's picture

Joined: 2002-12-22
Posts: 9
Posted: Wed, 2003-01-22 20:16

Have you purged your cache to get rid of the albums that should no longer be there?

Cheers

Quote:
I just tried Joseph Lane's solution for the random block on a stand alone gallery. I edited the file and got no errors once it was uploaded. However it is still pulling images from albums that I do not want to show as random images. This album is still a public album, but this album contains graphical walkthrough help topics.

Here is the code that I am using <!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> $name = $tmpAlbum->fields["name"];
if ($name != "graphics_not_used_yet") {
if ($name != "Help_Topics") {
if ($name != "Alumni_Database_Help") {
if ($name != "FTP_upload_help") {
if ($numPhotos > 0) {
$cache[$name] = $numPhotos;
}
}
}
}
}
}
}
}
?> </TD></TR></TABLE><!-- BBCode End -->

Any suggestions?

Thanks

 
Jared

Joined: 2002-09-29
Posts: 37
Posted: Wed, 2003-01-22 21:07

Wow, that was a good call! Now how do I clear the cache. Do I just delte the cache file?

After opening the cache file in a text editor, I noticed that the last update according to the server was today, and that the albums that I did not want displayed are not in there anymore. But for future referance, I guess one could just delete it, correct?

 
dodofreak
dodofreak's picture

Joined: 2002-12-09
Posts: 75
Posted: Thu, 2003-01-23 03:47

Yes, you can just delete the cache file. I've done it before when I noticed that there were some albums there which shouldn't have been there. Just reloaded my postnuke sie, and viola! It was fixed!

 
thesoarer
thesoarer's picture

Joined: 2002-10-05
Posts: 22
Posted: Mon, 2003-07-21 19:20

Where is the cache file?