T'Krin's Realm

My yammerings…

Tuesday, August 25, 2009

Add domain automatically to Default Identity in Horde when using standard passwd files

I did a lot of searching for this and finally came up with this solution based on a couple of different ones that I found. These changes will automatically fill in the domain portion of the e-mail address in the Default Identity and lock it down so users can not change their e-mail address on the server.

1 – Edit config/hooks.php and add the following hook:

if (!function_exists('_prefs_hook_from_addr')) {
function _prefs_hook_from_addr($user = null)
{
if (is_null($user)) {
$user = Auth::getAuth();
}
if (!empty($user)) {
$user = Auth::getAuth();
$mail = "$user" . "@example.com";
return (empty($mail) ? '' : $mail);
}
return '';
}
}

2 – Edit config/prefs.php and change

$_prefs['from_addr'] = array(
'value' => '',
'locked' => true,
'shared' => true,
'type' => 'text',
'desc' => _("Your From: address:")

to

$_prefs['from_addr'] = array(
'value' => '',
'locked' => true,
'hook' => true,
'shared' => true,
'type' => 'text',
'desc' => _("Your From: address:")
);

posted by tkrin at 7:39 AM  

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress