displaying anycontent only for a certain group displaying anycontent only for a certain group
 

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

displaying anycontent only for a certain group

Started by celeritycat, September 28, 2005, 09:41:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

celeritycat

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

Joachim Müller


celeritycat

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

Nibbler

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.

celeritycat

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

celeritycat

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

artistsinhawaii

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
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Joachim Müller

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

celeritycat

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

?>

Joachim Müller

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

celeritycat

Thank you so very much, it now works perfectly. And thank you for your patience.

artistsinhawaii

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
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.