username? username?
 

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]

Main Menu

username?

Started by zzz, January 26, 2006, 03:47:03 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

zzz

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?


Paver

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

zzz

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?

???

Paver

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:
$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:
<!-- 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 -->