![]() |
Getting a user's display name through LDAP/Active Directory - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Getting a user's display name through LDAP/Active Directory (/showthread.php?tid=33482) |
Getting a user's display name through LDAP/Active Directory - El Forum - 08-27-2010 [eluser]Ray Julich[/eluser] I am successfully authenticating user's with my CI site using the LDAP library. I would like to be able to get the user's full name to be able to display on the web pages. In the LDAP library there is a user_info() function and it looks like I can just do something like: Code: $user_info = $this->ldap->user_info($username) In looking at the LDAP library, it looks like to returns a 3D array, but when I try to print out the information in this array, I get an error. Code: echo $user_info[0]['displayname'][0] I'm not sure if the displayname is actually being set properly or if I'm referencing it incorrectly. Getting a user's display name through LDAP/Active Directory - El Forum - 08-27-2010 [eluser]bretticus[/eluser] Why not use the most useful PHP debugging function eva... ![]() Code: print_r($user_info); To see what you have exactly? Getting a user's display name through LDAP/Active Directory - El Forum - 08-27-2010 [eluser]Ray Julich[/eluser] When I use print_r($user_info), I get the following output: Code: Array ( [0] => Array ( [memberof] => Array ( [0] => ) ) ) Looks like it's not getting the user's information out of AD. These are the fields that the function user_info should be getting. Code: $fields=array( Code: $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields); Code: $entries[0]["memberof"][]="CN=Domain Users,CN=Users,".$this->_base_dn; Any thoughts? Getting a user's display name through LDAP/Active Directory - El Forum - 08-27-2010 [eluser]bretticus[/eluser] Sorry, wish I knew that adLDAP library better. However, I've never used it before. Looks like they have a support forum where you can try your luck though. Getting a user's display name through LDAP/Active Directory - El Forum - 08-27-2010 [eluser]Ray Julich[/eluser] I will do that, thank you. |