These are the hooks I set up in my Horde 5 setup to provide default Full Name and email addresses, retrieved from LDAP. It's based on the one on hooks.php.dist, but I had some issues with that so it's a bit tweaked. Runs on my CentOS 6 system. Rather than specifying LDAP server details in the hook, it uses the system's ability to ldapsearch - which makes troubleshooting easier too, just strip out the command and make it work on the command line.
It uses awk to get the email address from the returned grep'ed value, and cut to remove "cn: " from the Full Name. You may need to tweak those bits so it does what you need on your system.
You will need:
<?php class Horde_Hooks { public function prefs_init($pref, $value, $username, $scope_ob) { switch ($pref) { case 'from_addr': if (is_null($username)) { return $value; } $searchBase = 'ou=users,dc=yourdomain,dc=lan'; $cmd = '/usr/bin/ldapsearch -ZZ -x -b ' . $searchBase . ' uid=' . escapeshellcmd($username) . ' | /bin/grep mail | /usr/bin/awk \'{print $2}\''; $mails = `$cmd`; $mail_array = explode("\n", $mails); $mail = $mail_array['0']; return empty($mail) ? '' : $mail; case 'fullname': if (is_null($username)) { return $value; } $searchBase = 'ou=users,dc=yourdomain,dc=lan'; $cmd = '/usr/bin/ldapsearch -ZZ -x -b ' . $searchBase . ' uid=' . escapeshellcmd($username) . ' | /bin/grep cn: | /usr/bin/cut -c5-'; $cns = `$cmd`; $cn_array = explode("\n", $cns); $cn = $cn_array['0']; return empty($cn) ? $username : $cn; } } }