function ldap_user_load_user_acct_and_entity in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.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 1193 - 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', [
$account->uid,
]);
$user_entity = $user_entities[$account->uid];
}
else {
$user_entity = NULL;
}
return [
$account,
$user_entity,
];
}