Roundcube Community Forum

 

[0.1 stable] - Display IMAP username

Started by btcentral, March 09, 2008, 03:34:02 PM

Previous topic - Next topic

btcentral

I don't know about you, but I used to like this modification that allowed you to display the current user when you logged in.

So, I tried what they said again for 0.1 stable (I'd previously been using SVN releases) and noticed it didn't work properly. First of all the CSS wasn't working, and secondly some buttons that shouldn't be greyed-out were, javascript functionality was broken, etc.

So I played around with the code for a bit. And got it working again... here's what you need to do.



1. Open program/include/main.inc and search for 'username' => 'rcmail_current_username',

You should see:

// register common UI objects
 $OUTPUT->add_handlers(array(
  'loginform' => 'rcmail_login_form',
  'username' => 'rcmail_current_username',
  'message' => 'rcmail_message_container',
  'charsetselector' => 'rcmail_charset_selector',
 ));

Change it to this:

// register common UI objects
 $OUTPUT->add_handlers(array(
  'loginform' => 'rcmail_login_form',
  'username' => 'rcmail_current_username',
  'userdisplay' => 'rcmail_user_display',
  'message' => 'rcmail_message_container',
  'charsetselector' => 'rcmail_charset_selector',
 ));

2. Scroll to the bottom of the same file and find ?>

Above it add:

/***** display user information *****/

function rcmail_user_display($attrib)
 {
 if (!$attrib['id'])
  $attrib['id'] = 'rcmuserdisplay';

 // allow the following attributes to be added to the tag
 $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));

 $out = '';
 $out .= 'User: ';
 $out .= $_SESSION['username'];
 $out .= '
';
 return $out;
}

3. Edit skins/default/common.css, search for #taskbar

Above it, add:

.mailuser
{
 position: absolute;
 top: 12px;
 left: 200px;
 height: 8px;
 width: 120px;
 color: #333333;
 text-decoration: none;
 font-size: 10px;
 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
 z-index: 10;
}

4. Open skins/default/includes/taskbar.html, and add at the top of the file:




That's all folks.

Enjoy,
BTCentral
http://www.btcentral.org.uk - Cheap, Top Quality Web-design.

softdel

Thats a very nice mod and it works perfectly, this kind of thing should be included in releases by default, because you see this kind of thing in GMail and Yahoo and Hotmail... So why not roundcube?

Thanks.

GunFro

#2
.......................

Rudy

That's pretty awesome. Unfortunately it only shows IMAP User name. And that is something like web1p*. :( Nonetheless nice plugin.

softdel

Ahh, yeah I noticed that... But none the less it works fine, you dont really need the "User:" but anyway...

hkr

i get the foll error :

QuoteFatal error: Cannot redeclare rcmail_user_display() (previously declared in /home/clubturz/public_html/email/program/include/main.inc:1642) in /home/clubturz/public_html/email/program/include/main.inc on line 1987

btcentral

Quote from: GunFro Hi.
Nice mod, works just fine.
It would be even more fun if the text "User" followed the selected language.
Would be in program/localization/labeles.inc i think.
Yes, a lot off file to edit if You want all languages.
I made i even more simple, I removed the "User:" text.......

Have a nice day
Gunnar

Yeah, that's the easiest way to do it, at the end of the day this is a pretty "quick n' dirty" hack, if the developers were to end up implementing the feature, then obviously it would be worth their trouble to translate the tag, for now simply remove it, or change it yourself. :)

Quote from: Rudy That's pretty awesome. Unfortunately it only shows IMAP User name. And that is something like web1p*. :( Nonetheless nice plugin.

Ouch, that's a shame. I guess the IMAP server my host provides uses the [email protected] as the IMAP username format. This will obviously vary for different IMAP servers/configurations - I've changed the topic title to reflect this change.

Quote from: hkr i get the foll error :

QuoteFatal error: Cannot redeclare rcmail_user_display() (previously declared in /home/clubturz/public_html/email/program/include/main.inc:1642) in /home/clubturz/public_html/email/program/include/main.inc on line 1987

You've defined the same function twice, it even tells you the line numbers of each place you did in the error.

Cheers,
BTCentral
http://www.btcentral.org.uk - Cheap, Top Quality Web-design.

hkr

Yes,it does but how do i fix it, sorry my knowledge about php is very less, so pls help.

thnx..

stefanb


nerdykit

It's hard to click that link bacause of bad bbc.

Here's that link again.
Link to
http://roundcubeforum.net/forum/index.php?topic=2796.0

I prefer this version of the mod since it works better for me. The one that starts this thread is good but on my layout (which is standard) it puts the User: xxxx@yyyy beneath the RoundCube logo. Must be something weird in the css code.

amorino

Ciao Stefano
grazie mille per quello che hai fatto sei fortissimo ;)

********
Hello Stefano
Thanks a lot ;)