[horde] Hook Question

AJ aj at mindcrash.com
Tue May 10 08:10:26 PDT 2005


Ben,
  I think it is using ldap_search.. here is the hook I am using.
Any ideas?

Thanks.


if (!function_exists('_prefs_hook_fullname')) {

   function _prefs_hook_fullname($user = null)
   {

        $ldapServer = 'localhost';
        $ldapPort = '389';
        $searchBase = 'ou=Users,dc=mindcrash,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]['displayname'][0] != '') {
           $name = $information[0]['displayname'][0];
        } else {
           $name = $information[0]['gecos'][0];
        }

        ldap_close($ds);

        return $name;
   }
}





Quoting Ben Chavet <ben at horde.org>:

> use ldap_search() instead of ldap_list()
>
> --Ben
>
> Quoting AJ <aj at mindcrash.com>:
>
>> I have the fullname and from address hooks working for horde, however I
>> have a question.  I am using LDAP to get the information, and under my
>> Users OU, I have other OU's also containing user accounts.  So, here is
>> how it is set up:
>>
>> Some user accounts here:
>> ou=Users,dc=mindcrash,dc=com
>>
>> Other user accounts here:
>> ou=Other,ou=Users,dc=mindcrash,dc=com
>>
>> The hook works for the first example, and retrieves the info for
>> fullname and from address, but it does not for the second example.  It
>> seems that if there are other OU's it does not search down.  I am using
>> the hook examples from the wiki page.
>>
>> Any idea how to get it to search down through the ou?
>>
>> Thanks.
>> AJ
>>
>> --
>> 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
>>
>
>
>
> --
> 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