You are here

function ldap_user_load_user_acct_and_entity in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_user/ldap_user.module \ldap_user_load_user_acct_and_entity()

load user $account and $entity, given uid or $username

Parameters

string $user_id is username or uid:

enum $user_id_type is 'username' or 'uid':

return array $account and $user_entity

3 calls to ldap_user_load_user_acct_and_entity()
LdapUserConf::provisionLdapEntry in ldap_user/LdapUserConf.class.php
given a drupal account, provision an ldap entry if none exists. if one exists do nothing
LdapUserUnitTests::testProvisionToDrupal in ldap_user/tests/ldap_user.test
ldap_user_token_tokenize_entry in ldap_user/ldap_user.module
Turn an ldap entry into a token array suitable for the t() function

File

ldap_user/ldap_user.module, line 1178
Module for the LDAP User Entity

Code

function ldap_user_load_user_acct_and_entity($user_id, $user_id_type = 'username') {
  if ($user_id_type == 'username') {
    $account = user_load_by_name($user_id);
  }
  else {
    $account = user_load($user_id);
  }
  if ($account) {
    $user_entities = entity_load('user', array(
      $account->uid,
    ));
    $user_entity = $user_entities[$account->uid];
  }
  else {
    $user_entity = NULL;
  }
  return array(
    $account,
    $user_entity,
  );
}