You are here

public function LdapServer::userEmailFromLdapEntry in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/LdapServer.class.php \LdapServer::userEmailFromLdapEntry()

Parameters

ldap entry array $ldap_entry:

Return value

string user's mail value or FALSE if none present

1 call to LdapServer::userEmailFromLdapEntry()
LdapServer::userUserNameToExistingLdapEntry in ldap_servers/LdapServer.class.php
Queries LDAP server for the user.

File

ldap_servers/LdapServer.class.php, line 1178
Defines server classes and related functions.

Class

LdapServer
LDAP Server Class.

Code

public function userEmailFromLdapEntry($ldap_entry) {

  // Not using template.
  if ($ldap_entry && $this->mail_attr) {
    $mail = isset($ldap_entry[$this->mail_attr][0]) ? $ldap_entry[$this->mail_attr][0] : FALSE;
    return $mail;
  }
  elseif ($ldap_entry && $this->mail_template) {
    ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
    return ldap_servers_token_replace($ldap_entry, $this->mail_template, 'ldap_entry');
  }
  else {
    return FALSE;
  }
}