Advanced search  

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

Pages: [1]   Go Down

Author Topic: different text depends on if you are logged in or not?  (Read 20823 times)

0 Members and 1 Guest are viewing this topic.

hooch

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
different text depends on if you are logged in or not?
« 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
« Last Edit: November 10, 2004, 01:25:55 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: different text depends on if you are logged in or not?
« Reply #1 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
Logged

hooch

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: different text depends on if you are logged in or not?
« Reply #2 on: November 10, 2004, 09:57:17 am »

worked perfectly!
thank you GauGau!! ;D
Logged

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: different text depends on if you are logged in or not?
« Reply #3 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"?
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Nibbler

  • Guest
Re: different text depends on if you are logged in or not?
« Reply #4 on: December 13, 2004, 02:14:27 pm »

Yes, use the constant USER_NAME.
Logged

bbt2993

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: different text depends on if you are logged in or not?
« Reply #5 on: January 07, 2005, 11:35:21 am »

where and how do you use the "constant USER_NAME"
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: different text depends on if you are logged in or not?
« Reply #6 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
Logged

bbt2993

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: different text depends on if you are logged in or not?
« Reply #7 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
();

?>
Logged

tomrock

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
    • My Coppermine Gallery
Re: different text depends on if you are logged in or not?
« Reply #8 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.";



Logged

simplyzen

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: different text depends on if you are logged in or not?
« Reply #9 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?
Logged

Nibbler

  • Guest
Re: different text depends on if you are logged in or not?
« Reply #10 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.
Logged

qt4eva

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: different text depends on if you are logged in or not?
« Reply #11 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.
Logged

stock

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 109
Re: different text depends on if you are logged in or not?
« Reply #12 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: different text depends on if you are logged in or not?
« Reply #13 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.
Logged

stock

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 109
Re: different text depends on if you are logged in or not?
« Reply #14 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
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.