[SOLVED] Username in admin header?!?!

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

[SOLVED] Username in admin header?!?!

Post by jmansa »

I'm trying to alter the admin outlook a little bit by showing in admin header the logged in username, but can't seem to figure out how to get the record. Can somebody please help.

I have done this in my DefaultTheme.php around line 89:

Code: Select all

		global $gCms; $config =& $gCms->GetConfig();
		
		$thisuser->username = $user;
		
		$whouser = lang('usertop');
		$domain = lang('domain');
		$user = $thisuser->username;
		
		echo '<table width="100%" height="50px" border="0" cellspacing="0" cellpadding="0" bgcolor="#990000">
  				<tr>
    				<td style="padding-left:10px;color:#FFFFFF;"><div align="left">'.$domain.'<b>'.$config['sitename'].'</b><br>'.$whouser.''.$user.'</div></td>
    				<td><div align="right"><p class="logocontainer"><img src="themes/default/images/logo.png"></p></div></td>
  				</tr>
			 </table>';
But it doesnt get the current username... How do I go about that?
Last edited by jmansa on Wed Jan 23, 2008 7:32 pm, edited 1 time in total.
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

Re: Username in admin header?!?!

Post by jmansa »

I'm still looking for a solution... Any ideas anyone?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Username in admin header?!?!

Post by calguy1000 »

Try this:

Code: Select all

global $gCms;
$userops =& $gCms->GetUserOperations();

$user = $userops->LoadUserById(get_userid());
echo "username = ".$user->username."<br/>";
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jmansa
Forum Members
Forum Members
Posts: 126
Joined: Thu Oct 19, 2006 2:46 pm

Re: Username in admin header?!?!

Post by jmansa »

Thanks alot... That did the job!  ;)
Post Reply

Return to “Developers Discussion”