coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: celeritycat on September 28, 2005, 09:41:19 AM

Title: displaying anycontent only for a certain group
Post by: celeritycat on September 28, 2005, 09:41:19 AM
I know this question was asked about CPG when it is bridged, but I have searching for hours to see if this can be done as a standalone.
I am using the most recent stable version 1.3.5 and I wanted to know if anycontent.php could only be visible when a particular group is viewing your albums. Not necessarily a registered group, just a group of your choosing, like say a friend group? ;D
Title: Re: displaying anycontent only for a certain group
Post by: Joachim Müller on September 28, 2005, 10:46:17 AM
http://forum.coppermine-gallery.net/index.php?topic=11619.0
Title: Re: displaying anycontent only for a certain group
Post by: celeritycat on September 29, 2005, 09:57:56 AM
Quote from: GauGau on September 28, 2005, 10:46:17 AM
http://forum.coppermine-gallery.net/index.php?topic=11619.0

Respectfully, that thread is based on all registered users, maybe I was not clear.
i.e. I have a group name family, and even though they are registered users to have albums, I would like to have anycontent.php showing only when they are logged in. So not all registered users can see anycontent, just those of the family group.
Thanks a bunch ;D
Title: Re: displaying anycontent only for a certain group
Post by: Nibbler on September 29, 2005, 03:20:20 PM
Instead of using

if (USER_ID){

use

if (in_array(9, $USER_DATA['groups'])){

Where 9 is the group number of the group you want to allow.
Title: Re: displaying anycontent only for a certain group
Post by: celeritycat on September 29, 2005, 06:17:25 PM
Quote from: Nibbler on September 29, 2005, 03:20:20 PM
Instead of using

if (USER_ID){

use

if (in_array(9, $USER_DATA['groups'])){

Where 9 is the group number of the group you want to allow.

Just one more thing, what is the code to add a another group number
say like group 5 and administrator 1 (ME).
But otherwise that works great! Thank you so very much ;D
Title: Re: displaying anycontent only for a certain group
Post by: celeritycat on September 30, 2005, 04:41:01 AM
Hello, anybody can take a crack at my question above? I almost have everything just right, I just need that last bit of info.
I know the guys here are very busy so feel free to jump in and offer a suggestion, anybody? ;D
Title: Re: displaying anycontent only for a certain group
Post by: artistsinhawaii on September 30, 2005, 05:31:17 AM
I suppose you could try something like this..


if (in_array(9, $USER_DATA['groups'])){
    // do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user

} else {
if (in_array(10, $USER_DATA['groups'])){
    // do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user

} else {

    print 'You\'re not logged in. <br />Click <a href="login.php">login</a> if you already have an account for this site or <a href="register.php">register</a> to sign up for a new account.';
}


Dennis
Title: Re: displaying anycontent only for a certain group
Post by: Joachim Müller on September 30, 2005, 08:34:54 AM
Quote from: celeritycat on September 30, 2005, 04:41:01 AM
Hello, anybody can take a crack at my question above? I almost have everything just right, I just need that last bit of info.
I know the guys here are very busy so feel free to jump in and offer a suggestion, anybody? ;D
http://coppermine.sourceforge.net/faq.php#lamesupport
Title: Re: displaying anycontent only for a certain group
Post by: celeritycat on September 30, 2005, 09:21:50 AM
I was not implying that support was ignoring me or not providing support quick enouph. I was simply stating that you guys are really busy and asked if someone else had a suggestion.  That's all!  I kind of thought that is what support boards are for, if another user has some imput, they will help you out! I am sorry If I offended you. You have been very helpful and your script is outstanding.

Now Having said that, I tried the code the way madeinhawaii suggested, but I keep getting  Parse errors. This is what I have now and it works for the one group, but I would like to add me the admisitrator into the code. I am not very cody savy when it come to php, it's very new to me.

starttable("100%", "Welcome $user_name");

?>
<tr><td class="tableb" >
<?php
if (in_array(5$USER_DATA['groups'])){

echo 
' Family Links';

} else {



echo 
' Guest, Feel free to browse the public albums, post comments, and rate files, but you can not post images without logging in or registering. Click <a href="login.php">login</a> if you already have an account for this site or <a href="register.php">register</a> to sign up for a new account. <I>Please be aware that your IP will be banned if you post profanity and any abusive behavior</I>';

}
?>

</br></br>
<script src="http://www.velvet-peacock.com/cgi-bin/equotes/equotes.cgi?display=1&java=1"></script>
<img src="/images/space.gif" width="10" height="3"><span class="style12"><a href="http://velvet-peacock.com/cgi-bin/equotes/equotes.cgi?new=1" target="_blank">Add Your eQuote</a></span>
<img src="/emoticons/smile9.gif" width="15" height="15">
</td></tr></br>
<?php
endtable
();

?>
Title: Re: displaying anycontent only for a certain group
Post by: Joachim Müller on September 30, 2005, 09:24:48 AM
doesn'tif (in_array(9, $USER_DATA['groups']) || in_array(1, $USER_DATA['groups'])){do what you're trying to accomplish? In case you're wondering: the ||reads as "OR".
Title: Re: displaying anycontent only for a certain group
Post by: celeritycat on September 30, 2005, 09:33:52 AM
Thank you so very much, it now works perfectly. And thank you for your patience.
Title: Re: displaying anycontent only for a certain group
Post by: artistsinhawaii on September 30, 2005, 10:53:03 AM
Quote from: GauGau on September 30, 2005, 09:24:48 AM
doesn'tif (in_array(9, $USER_DATA['groups']) || in_array(1, $USER_DATA['groups'])){do what you're trying to accomplish? In case you're wondering: the ||reads as "OR".

Thanks for covering me again, Gaugau.. I wasn't sure the || would work in that line.  Now I know. 

Dennis