forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: hooch on November 09, 2004, 11:42:13 pm

Title: different text depends on if you are logged in or not?
Post by: hooch on November 09, 2004, 11:42:13 pm
Hi!

I have a text in anycontent who says hello and welcome blabla.. register to see the pictures..
but i dont want this to be seen if you already are logged in, then i want another text..

how do i do this? with come kind of if-thing but how do it wkow if im logged in or not?

/Gustav
Title: Re: different text depends on if you are logged in or not?
Post by: Joachim Müller on November 10, 2004, 08:27:49 am
Put this code into anycontent.php
Code: [Select]
<?php
if (USER_ID) {
    
// 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. If you were, you could do so many things you currently can\'t.<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.';
}
?>

Joachim
Title: Re: different text depends on if you are logged in or not?
Post by: hooch on November 10, 2004, 09:57:17 am
worked perfectly!
thank you GauGau!! ;D
Title: Re: different text depends on if you are logged in or not?
Post by: fareforce on December 12, 2004, 09:18:09 pm
Quick question about this. This is what I put in for the script

Quote
<?php
if (USER_ID) {
print 'Welcome to AlaskaStudio.com, and thank you for logging in. As a member

of AlaskaStudio.com you have full access to all functions of this site. We

recently added <b>ecards</b>! Please tell your freinds about this site by

sending them an ecard.';
    // 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. If you were, you could do so many things you

currently can\'t.<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.';
}
?>

Is there a way to make it say Welcome "username"?
Title: Re: different text depends on if you are logged in or not?
Post by: Nibbler on December 13, 2004, 02:14:27 pm
Yes, use the constant USER_NAME.
Title: Re: different text depends on if you are logged in or not?
Post by: bbt2993 on January 07, 2005, 11:35:21 am
where and how do you use the "constant USER_NAME"
Title: Re: different text depends on if you are logged in or not?
Post by: Joachim Müller on January 07, 2005, 11:38:14 am
where and how do you use the "constant USER_NAME"
Not at all if you're no PHP coder.

Joachim
Title: Re: different text depends on if you are logged in or not?
Post by: bbt2993 on January 07, 2005, 11:45:30 am
Hi

In starttable("100%", "Velkommen"); after "Velkommen"

Code: [Select]
<?php
// ------------------------------------------------------------------------- //
// CVS version: $Id: anycontent.php,v 1.5 2004/07/24 15:03:52 gaugau Exp $
// ------------------------------------------------------------------------- //

starttable("100%""Velkommen");

?>

<tr><td class="tableb" >
<?php
if (USER_ID) {
    
// do nothing - a user is logged in
    // we could print out anything here to say welcome to the logged in user
} else {
    print 
'Du er ikke loget ind. Hvis du var kunne du sċ meget mere end du kan nu.<br />Klik <a href="login.php">log ind</a> hvis du allerede er oprettet som bruger eller <a href="register.php">opret bruger</a> for at oprette en konto.';
}
?>

</td></tr>
<?php
endtable
();

?>
Title: Re: different text depends on if you are logged in or not?
Post by: tomrock on April 06, 2005, 04:35:01 pm
where and how do you use the "constant USER_NAME"

Something like
Code: [Select]
echo USER_NAME . " thanks for logging in.";



Title: Re: different text depends on if you are logged in or not?
Post by: simplyzen on April 19, 2005, 04:25:25 pm
In the theme.php can we use php code?  i.e. will it work if it's place in a
Code: [Select]
$template_main_menu1 = <<<EOT EOT; section?
Title: Re: different text depends on if you are logged in or not?
Post by: Nibbler on April 19, 2005, 04:36:54 pm
No. If you want to add php then stop the heredoc, add your code, and resume it.
Title: Re: different text depends on if you are logged in or not?
Post by: qt4eva on April 23, 2005, 05:14:07 am
where and how do you use the "constant USER_NAME"

Something like
Code: [Select]
echo USER_NAME . " thanks for logging in.";
is there a way to change so that  it said. Thanks fo loggin in [Username].  I tried to do " Thanks for logging in" echo USER_NAME; but it not working.
Quote

<?php
if (USER_ID) {
    // 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. If you were, you could do so many things you currently can\'t.<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.';
}
?>

How do i align this so that this is set to the right of the page? TIA for help. Sorry am a noob at php.
Title: Re: different text depends on if you are logged in or not?
Post by: stock on August 15, 2005, 01:36:30 am
Could someone help.

Does one put this code:
<?php
/*************************
  COPPERMINE BIT HERE TAKEN OUT FOR CLARITY, IGNORE
**********************************************/

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

?>
<tr><td class="tableb" >
<?php
if (USER_ID) {
    // 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.';
}
?>
</td></tr>
<?php
endtable();

?>

Into anycontent.php then do something else to make a box come up before they can access the site? This is what I want to do if possible. Thanks for any help
Title: Re: different text depends on if you are logged in or not?
Post by: Joachim Müller on August 15, 2005, 06:26:53 am
no, do as suggested in http://coppermine.sourceforge.net/faq.php#registeredUsersOnly instead to accomplish what you're up to.
Title: Re: different text depends on if you are logged in or not?
Post by: stock on August 15, 2005, 09:35:32 pm
many thanks, I did try and find this an apologies that I hadn't. It works perfectly.

Stock