forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: zzz 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?
-
You can use $USER_DATA['user_name'] in your theme.php to display the logged-in username.
-
not really sure as to what to do...
id like it displayed like so...
<!-- BEGIN logout -->
<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?
???
-
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 -->
<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 -->
<font size="1" color="#ffffff"><b>you are logged in {$USER_DATA['user_name']} <a href="{LOGOUT_TGT}">[logout]</a></b></font>
<!-- END logout -->