#1  
Old 24th January 2010, 11:09
kinai kinai is offline
Junior Member
 
Join Date: Aug 2008
Location: Troyes, France
Posts: 28
Thanks: 0
Thanked 2 Times in 2 Posts
Default Simple feature

Hi all,

Is it possible to add in the top banner, the username of the current login user, near logout button.

For example,
  • You are 'ISP Admin (user admin)'
  • You are 'Resellers1 Admin (user resell1)
  • You are 'Kinaï (user kinai)

Thanks,
kinai
Reply With Quote
Sponsored Links
  #2  
Old 4th March 2010, 04:10
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Here's a hack that will put the user name under the logo. The page needs to be refreshed once first though so not a perfect hack.

In /var/www/ispconfig/themes/default/templates/main.tpl.htm change line 75

from
Code:
<span>hosting control panel</span>
to
Code:
<span>hosting control panel</span><?php echo (!($_SESSION['s']['user']['username'] == '')) ? '<br /> user:  '.$_SESSION['s']['user']['username'] : '' ; ?>
Add that extra bit of code anywhere you want the user name to show up. No promises that this won't break something. There might be a more direct way to get the user name as well but I just hacked around until something worked.
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 4th March 2010 at 04:15.
Reply With Quote
  #3  
Old 3rd April 2010, 23:59
kinai kinai is offline
Junior Member
 
Join Date: Aug 2008
Location: Troyes, France
Posts: 28
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I'm applying this hack under this line.

Code:
<span><a href="#logout" onclick="loadContent('login/logout.php');">LOGOUT</a><!-- | <a href="#" onclick="capp('help')">Help</a> | <a href="#">Imprint</a>--></span>
and I try to change your code like

<?php echo (!($_SESSION['s']['user']['username'] == '')) ? "<br /> {tmpl_var name='username_txt'}: ".$_SESSION['s']['user']['username'] : '' ; ?>

but it's not working ...
Could you help me ...

Thanks,
Regards,
Kinai
Reply With Quote
  #4  
Old 4th April 2010, 01:52
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Not sure what you're trying to do and your syntax looks messed up.

maybe you want...

<?php
echo "<br>";
echo ($_SESSION['s']['user']['username'] != '') ? {tmpl_var name='username_txt'}:$_SESSION['s']['user']['username'];
?>
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #5  
Old 4th April 2010, 08:31
kinai kinai is offline
Junior Member
 
Join Date: Aug 2008
Location: Troyes, France
Posts: 28
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi,

I'm trying to display

Username: Admin

under logout link.

a better solution was to have an other field to do it :

in en_EN: current_user_text = "Your are now connected as"
in fr_FR: current_user_text = "Vous êtes actuellement connecté en tant que"

your php code is not working, page is not displaying.
Reply With Quote
  #6  
Old 4th April 2010, 16:22
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

The first one posted works but the page needs to be refreshed. The code using the template was just trying to fix the syntax. Didn't try your code to see if it worked.
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #7  
Old 6th April 2010, 10:04
mike_p mike_p is offline
Senior Member
 
Join Date: Mar 2010
Location: Surrey, England
Posts: 140
Thanks: 9
Thanked 28 Times in 17 Posts
Default

I have just posted an alternative method that does not break the template concept of avoiding mixing PHP into your HTML.

Edit the "public function tpl_defaults()"
in app.inc.php

add this to the bottom of the function:
Code:
    if(isset($_SESSION['s']['user'])) {
      $this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
	    }
Then in your templates you can use
<tmpl_var format="strtoupper" name="cpuser">

for example alongside the word LOGOUT in main.tpl.htm

Hopefully the 'bosses' will include my suggested change to app.inc.php in future versions!
Reply With Quote
  #8  
Old 8th April 2010, 09:39
skoena skoena is offline
Senior Member
 
Join Date: Sep 2009
Location: Emmen, Netherlands
Posts: 413
Thanks: 75
Thanked 11 Times in 10 Posts
Send a message via MSN to skoena Send a message via Skype™ to skoena
Default

I only get the name showed when I hit the refresh button (F5).
Reply With Quote
  #9  
Old 8th April 2010, 15:27
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Quote:
Originally Posted by rudolfpietersma View Post
I only get the name showed when I hit the refresh button (F5).
As stated in #2 above "The page needs to be refreshed once first though so not a perfect hack." It would be interesting to know why if someone has the time to figure it out.
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #10  
Old 7th May 2010, 16:11
vogelor vogelor is offline
ISPConfig Developer
 
Join Date: Jan 2007
Location: Wernau, Germany
Posts: 219
Thanks: 42
Thanked 34 Times in 24 Posts
 
Default

Quote:
Originally Posted by mike_p View Post
Hopefully the 'bosses' will include my suggested change to app.inc.php in future versions!
i am not "the boss" - just a developer ;-)
But ... your code is in SVN...

Olli
__________________
Der neue Luxus heißt Zeit, nicht Geld!

Firma : http://www.muv.com, http://www.computerandservice.de
Privat : http://www.vogelor.de
Reply With Quote
The Following User Says Thank You to vogelor For This Useful Post:
mike_p (7th May 2010)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple(?) help with Gparted resizing alexlinco HOWTO-Related Questions 4 13th October 2009 23:38
Need help getting started simple simple shell script dhonnoll78 Programming/Scripts 1 18th December 2007 12:05
2 Simple features wpwood3 Feature Requests 0 28th October 2007 22:46
Request Feature Enhancement for ISPConfig 3.x ptiggerdine Feature Requests 9 23rd May 2007 09:47
simple feature - "monitor file" sygram Feature Requests 6 21st May 2007 10:36


All times are GMT +2. The time now is 09:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.