[horde] Re: Hook question

Al Brussey aj at mindcrash.com
Mon Mar 7 07:12:48 PST 2005


Well, I got the fullname hook to work for any attribute other than 
displayName,
which unfortunately is what I need.
It pulls the 'sn' and 'description' attribute fine, but if I changed it to
displayName it does not work, does anyone have any idea as to why that is?

Thanks.
AJ




Quoting Craig White <craigwhite at azapple.com>:

> On Sun, 2005-03-06 at 17:28 -0500, AJ wrote:
>> Hi,
>>   I am trying to enable the fullname and from_addr hooks from the wiki.
>> I copied everything over, and made sure that hook => true in
>> horde/config/prefs.php, but the hooks just never fire.  I also 
>> cleared out the
>> prefs, so that it emulates the first login.  Does anyone know why 
>> these hooks
>> are not firing?  Any help w/ this would be great.  I am using the 
>> LDAP examples
>> from the wiki.
> ----
> 'hook' => 'true',
>
> ^^^^^^^^^^^^^^^^ I think this is literally how it must be.
>
> You may be able to omit the single quotes around the word true
>
> You would have to change $searchBase to the ou which contains your user
> entries...
>
> as long as you can do this...
>
> ldapsearch -x -h localhost -D "uid=YOUR_USER_NAME,$searchBase" -b
> "$searchbase" -W "(uid=YOUR_USER_NAME)"
>
> it will work...
>
> lastly, I did modify my setup some since the wiki (I should change
> that). The difference should be obvious.
>
> if (!function_exists('_prefs_hook_from_addr')) {
>
>   function _prefs_hook_from_addr($user = null)
>     {
>
>       $domain_name = 'azapple.com';
>       $ldapServer = 'localhost';
>       $ldapPort = '389';
>       $searchBase = 'ou=People,dc=azapple,dc=com';
>       $ds = @ldap_connect($ldapServer, $ldapPort);
>
>       if (is_null($user)) {
>         $user = Auth::getAuth();
>       }
>
>       $uid = Auth::getBareAuth();
>       $binddn = 'uid=' . $uid . ',' . $searchBase;
>       $bindpw = Auth::getCredential('password');
>
>       if (@ldap_bind($ds, $binddn, $bindpw)) {
>         $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $uid);
>       }
>
>       $information = @ldap_get_entries($ds, $searchResult);
>
>        // derive the email address if possible
>        if ($information[0]['mail'][0] != '') {
>           $emailname = $information[0]['mail'][0];
>        } else {
>           $emailname = $information[0]['uid'][0] . '@' . $domain_name;
>        }
>
>         ldap_close($ds);
>
>         return $emailname;
>     }
> }
>
>
> Craig
>
>
>
> --
> Horde mailing list - Join the hunt: http://horde.org/bounties/#horde
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>





More information about the horde mailing list