[horde] Hook question

AJ aj at mindcrash.com
Sat Jul 24 15:57:02 PDT 2004


Still having some problems w/ this hook..
If I leave it as 'cn' it will pull the cn attribute as the fullname, but 
if I change it to displayName, it still will use the cn attrbute.
Does anyone know how I can get this hook to use an attribute other than cn.

Thanks.
AJ

 > 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);
 >      }
 > }



More information about the horde mailing list