Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: username?  (Read 2581 times)

0 Members and 1 Guest are viewing this topic.

zzz

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
username?
« on: January 26, 2006, 03:47:03 am »

im trying to display a members logged in username in my theme in cpg 1.4.3, the logout link displays the members logged in name in brackets - is it relatively easy to use that edited code ? does anyone know where it resides in cpg 1.4.3?

could anyone give me any pointers?

Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: username?
« Reply #1 on: January 26, 2006, 08:20:43 am »

You can use $USER_DATA['user_name'] in your theme.php to display the logged-in username.
Logged

zzz

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: username?
« Reply #2 on: January 26, 2006, 12:52:38 pm »

not really sure as to what to do...

id like it displayed like so...

<!-- BEGIN logout -->
&nbsp;&nbsp;<font size="1" color="#ffffff"><b>you are logged in {USER_NAME} <a href="{LOGOUT_TGT}">[logout]</a></b></font>
<!-- END logout -->

im not too sure as to where to put that line or how it will fit in that line of code?

 ???
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: username?
« Reply #3 on: January 26, 2006, 05:33:09 pm »

It's true that USER_NAME is a constant with the username string in it, but you cannot put a constant in curly braces.  If you want to use the USER_NAME constant, you need to break out of your string, concatenate the constant, then enter back into your string.  I'm guessing you're using the heredoc syntax so here's an example:
Code: [Select]
$var = <<<EOT
<!-- BEGIN logout -->
&nbsp;&nbsp;<font size="1" color="#ffffff"><b>you are logged in
EOT;
$var .= USER_NAME;
$var .= <<<EOT
 <a href="{LOGOUT_TGT}">[logout]</a></b></font>
<!-- END logout -->
EOT;

It's a bit ugly-looking if you have a long string using heredoc.  A nicer-looking option is to use $USER_DATA['user_name'] as I said.  For your case, replace what you typed with this:
Code: [Select]
<!-- BEGIN logout -->
&nbsp;&nbsp;<font size="1" color="#ffffff"><b>you are logged in {$USER_DATA['user_name']} <a href="{LOGOUT_TGT}">[logout]</a></b></font>
<!-- END logout -->
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.