Roundcube Community Forum
Third Party Contributions => Old Style Plug-Ins => Topic started by: loganrockmore on August 23, 2007, 04:34:01 PM
-
I've created a small plug-in that will auto-complete the email address with the domain name when logging in. So, instead of typing "user@domain.com", you can just type "user" and when the username field loses focus, the "@domain.com" will automatically be added.
I've put the instructions on my blog at http://www.loganrockmore.com/blog/?p=120 and I'll repeat them here:
Open program/include/main.inc. On line 1446, replace
$input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30, 'autocomplete' => 'off'));
with the two lines
$domain = preg_replace("/^www\./", "", $_SERVER['HTTP_HOST']);
$input_user = new textfield(array('name' => '_user', 'id' => 'rcmloginuser', 'size' => 30, 'autocomplete' => 'off', 'onchange' => 'domainautocomplete(\'' . $domain . '\');'));
(Note: if your Roundcube installation is located somewhere like webmail.domain.com, then change “www” in the first line to “webmail”. Basically, that line just gets rid of the first part of the domain, so you’re left with “domain.com” )
Open program/include/rcmail_template.inc. On line 60, after
$this->include_script('app.js');
add the line
$this->include_script('domainautocomplete.js');
Finally, in the directory program/js/ create a new file titled domainautocomplete.js and add this content
function domainautocomplete(domain) {
var loginField = document.getElementById('rcmloginuser');
if( loginField.value != '' &&
loginField.value.indexOf('@') == -1 ) {
loginField.value = loginField.value + "@" + domain;
}
}
-
Or... you could just go in to config/main.inc.php and edit this to:
$rcmail_config['username_domain'] = 'domain.com';
That would work to.
-
How to change «@» on «+» in address autocomplete? Our provider maked logins for email such: e-mail: test@domain.com, but login: test+domain.com and domain.com+test. I need solutuion for two my examples. Help, please :)
-
Have you tried my solution? It doesn't have any of the js files and its built into round cube so that should work.