[horde] Hook question

AJ aj at mindcrash.com
Mon Jul 19 17:55:13 PDT 2004


Hi,
   I am trying to get the fullname hook working.
I am trying to fetch the fullname from an ldap attribute called 
displayName.  Here is what I have in hooks.php:

if (!function_exists('_prefs_hook_fullname')) {
     function _prefs_hook_fullname($user = null)
     {
         $ldapServer = 'localhost';
         $ldapPort = '389';
         $searchBase = 'ou=Users,dc=mindcrash,dc=com';
         $ldapcharset = 'utf-8';
         $outputcharset = NLS::getCharset();

         $ds = @ldap_connect($ldapServer, $ldapPort);

         if (is_null($user)) {
             $user = Auth::getAuth();
         }
         $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $user);
         $information = @ldap_get_entries($ds, $searchResult);
             $name = $information[0]['displayName'][0];

         ldap_close($ds);

         $name = String::convertCharset($name, $ldapcharset, 
$outputcharset);
         return (empty($name) ? $user : $name);
     }
}

This does not work..  I added 'hook' => true to the fullname stanza in 
prefs.php, and also added $conf['hooks']['fullname'] = true; to 
conf.php, both with no results.. I have cleared out my horde_prefs 
before each trial.  Can anyone help?

Thanks.
AJ



More information about the horde mailing list