I have a user search module in drupal that creates contact cards base on LDAP user information. Everything works fine, I just need to make it more flexible, so that if the same module is used in a different drupal install, it can just set the same ldap server that is set in drupal. Currently it is hard-coded.
first, I tried using this to get the server info:
$ldapServer = db_query("SELECT address FROM ldap_servers WHERE `binddn` = 'cn=Directory Manager'");
print_r( $ldapServer);
This is what the query returned:
DatabaseStatementBase Object ( [dbh] => DatabaseConnection_mysql Object ( [needsCleanup:protected] => [target:protected] => default [key:protected] => default [logger:protected] => [transactionLayers:protected] => Array ( ) [driverClasses:protected] => Array ( [MergeQuery] => MergeQuery [SelectQuery] => SelectQuery [UpdateQuery] => UpdateQuery [InsertQuery] => InsertQuery_mysql ) [statementClass:protected] => DatabaseStatementBase [transactionSupport:protected] => 1 [transactionalDDLSupport:protected] => [temporaryNameIndex:protected] => 0 [connectionOptions:protected] => Array ( [database] => tlsconnectapp [username] => drupal [password] => drupal [host] => localhost [port] => [driver] => mysql [prefix] => Array ( [default] => ) ) [schema:protected] => [prefixes:protected] => Array ( [default] => ) [prefixSearch:protected] => Array ( [0] => { [1] => } ) [prefixReplace:protected] => Array ( [0] => [1] => ) ) [queryString] => SELECT address FROM ldap_servers WHERE
binddn
= 'cn=Directory Manager' )
I'm sure I did something wrong, but I'm not sure what this means, and the server isn't in there.