Roundcube Community Forum

Third Party Contributions => Old Style Plug-Ins => Topic started by: btcentral on March 09, 2008, 03:34:02 PM

Title: [0.1 stable] - Display IMAP username
Post by: btcentral on March 09, 2008, 03:34:02 PM
I don't know about you, but I used to like this (http://roundcubeforum.net/forum/index.php?topic=143.0) 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.

(http://img80.imageshack.us/img80/8858/rcmdispmc3.png)

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

You should see:

Code: [Select]
// 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:

Code: [Select]
// 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:

Code: [Select]
/***** 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:

Code: [Select]
.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:

Code: [Select]



That's all folks.

Enjoy,
BTCentral
Title: Re: 0.1 stable - Display current user
Post by: softdel on March 09, 2008, 04:01:08 PM
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.
Title: Re: 0.1 stable - Display current user
Post by: GunFro on March 09, 2008, 10:38:15 PM
.......................
Title: Re: 0.1 stable - Display current user
Post by: Rudy on March 10, 2008, 05:09:58 AM
That's pretty awesome. Unfortunately it only shows IMAP User name. And that is something like web1p*. :( Nonetheless nice plugin.
Title: Re: 0.1 stable - Display current user
Post by: softdel on March 10, 2008, 08:07:21 AM
Ahh, yeah I noticed that... But none the less it works fine, you dont really need the "User:" but anyway...
Title: Re: 0.1 stable - Display current user
Post by: hkr on March 10, 2008, 12:21:21 PM
i get the foll error :

Quote
Fatal 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
Title: Re: 0.1 stable - Display current user
Post by: btcentral on March 11, 2008, 09:25:08 AM
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 username@domain.com 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 :

Quote
Fatal 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
Title: Re: [0.1 stable] - Display IMAP username
Post by: hkr on March 12, 2008, 10:44:23 AM
Yes,it does but how do i fix it, sorry my knowledge about php is very less, so pls help.

thnx..
Title: Re: [0.1 stable] - Display IMAP username
Post by: stefanb on March 13, 2008, 06:15:52 PM
What do you think about this hack to view username?
[url]http://roundcubeforum.net/forum/index.php?topic=2796.0 (http://[b)[/b][/url]
Title: Re: [0.1 stable] - Display IMAP username
Post by: nerdykit on March 15, 2008, 07:47:33 PM
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 (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.
Title: Re: [0.1 stable] - Display IMAP username
Post by: amorino on March 19, 2008, 05:23:23 PM
Ciao Stefano
grazie mille per quello che hai fatto sei fortissimo ;)

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