forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: zac on January 08, 2008, 10:11:46 am

Title: Change message for logged out users
Post by: zac on January 08, 2008, 10:11:46 am
Hi.. I am wondering how I could have a different message or home page for users who are not logged in.  My gallery is to be used strictly for portrait customers so if you are not logged in there is just a message telling you to log in.  The way I have it now this message just sits in the category description and is always there.  I would like to make it so the message changes or disappears after a user logs in.  Can someone give me a pointer on how to achieve this?   I have  searched around for a while but I need to get some sleep :P
Title: Re: Change message for logged out users
Post by: Nibbler on January 08, 2008, 11:04:09 am
Use anycontent.php with an if.

Code: [Select]
<?php

if (!USER_ID){
// some content here
}
Title: Re: Change message for logged out users
Post by: zac on January 08, 2008, 07:13:00 pm
Thanks Nibbler.. That is sort of it.. however I kind of want the opposite a message that is there when you are not logged in and disappears when you are.    For example I tried

Code: [Select]
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
starttable("100%", "Welcome");
echo "<tr><td class=\"table\" ><a href=\"http://www.otherdomain/some_gallery/".USER_ID."\">Open your gallery, ".USER_NAME.".</a></td></tr>";
endtable();
if (USER_ID) {
starttable("100%", "");
echo "<tr><td class=\"table\" ></td></tr>";
endtable();
Title: Re: Change message for logged out users
Post by: Nibbler on January 08, 2008, 07:22:56 pm
You missed out the negation (!).
Title: Re: Change message for logged out users
Post by: zac on January 08, 2008, 07:54:52 pm
Got it!  Thanks Nibbler ... I need PHP 101  :-\

Code: [Select]
if (USER_ID) {
starttable("100%", "nothing to see here");
echo "<tr><td class=\"table\" >&nbsp;</td></tr>";
endtable();
}
else {
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
starttable("100%", "Welcome");
echo "<tr><td class=\"table\" ><a href=\"http://www.otherdomain/some_gallery/".USER_ID."\">Open your gallery, ".USER_NAME.".</a></td></tr>";
endtable();

}