You are here

function simple_ldap_user_user_load in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 simple_ldap_user/simple_ldap_user.module \simple_ldap_user_user_load()

Implements hook_user_load().

Fires when user information is being loaded from the database. User information is cached, so this does not fire every time a user object is handled.

File

simple_ldap_user/simple_ldap_user.module, line 414
Main simple_ldap_user module file.

Code

function simple_ldap_user_user_load($users) {
  $sync = simple_ldap_user_variable_get('simple_ldap_user_sync');
  $puid_attr = simple_ldap_user_variable_get('simple_ldap_user_unique_attribute');
  if ($sync == 'hook_user_load') {
    foreach ($users as $account) {
      if ($account->uid == 1) {
        continue;
      }
      switch (simple_ldap_user_variable_get('simple_ldap_user_source')) {
        case 'ldap':
          simple_ldap_user_sync_user_to_drupal($account);
          break;
        case 'drupal':
          simple_ldap_user_sync_user_to_ldap($account);
          break;
      }
    }
  }
}