I have a drupal install that uses LDAP to authenticate users. I use that same LDAP to return user info such as roles, employee photo, email, role, and the center they work at.
$ds=ldap_connect("ldap-example.com");
if ($ds) {
$r=ldap_bind($ds);
$sr=ldap_search($ds, "DC=tpcontact,DC=co,DC=uk",$search);
$info = ldap_get_entries($ds, $sr)or die('get info fail');
}
I need to make it so that the server is pulled from drupal. So, if it is possible to query ldap without reconnecting, I need to do that. Otherwise I need to query the drupal DB's ldap_servers table, the only problem is that I dont have access to a MySql database that has LDAP enabled to see what the field is.
ldap_query
,ldap_feeds
andldap_views
are all designed to let you run queries like this at any time. you shouldn't have to write the query yourself (but more power to you if you can).