? 867356-02.patch
? ldapsync-synchronize-ldapdata-0.patch
Index: ldapdata.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ldap_integration/ldapdata.module,v
retrieving revision 1.31
diff -u -p -r1.31 ldapdata.module
--- ldapdata.module	27 Oct 2009 14:29:17 -0000	1.31
+++ ldapdata.module	3 Jan 2011 00:47:57 -0000
@@ -185,7 +185,7 @@ function _ldapdata_user_form(&$user, $ca
 /**
  * Implements hook_user() load operation.
  */
-function _ldapdata_user_load(&$account, $sync = FALSE) {
+function _ldapdata_user_load(&$account, $sync = FALSE, $newentry = NULL) {
   global $user, $_ldapdata_ldap;
 
   // Setup the global $_ldapdata_ldap object.
@@ -208,13 +208,28 @@ function _ldapdata_user_load(&$account, 
   }
 
   $accounts_synced[$account->uid] = TRUE;
-  $bind_info = _ldapdata_edition($account);
-  if (!$_ldapdata_ldap->connect($bind_info['dn'], $bind_info['pass'])) {
-    watchdog('ldapdata', "User load: user %name's data could not be read in the LDAP directory", array('%name' => $account->name), WATCHDOG_WARNING);
-    return;
+
+  if (is_null($newentry)){
+    $bind_info = _ldapdata_edition($account);
+    if (!$_ldapdata_ldap->connect($bind_info['dn'], $bind_info['pass'])) {
+      watchdog('ldapdata', "User load: user %name's data could not be read in the LDAP directory", array('%name' => $account->name), WATCHDOG_WARNING);
+      return;
+    }
+
+    $entry = $_ldapdata_ldap->retrieveAttributes($account->ldap_dn);
+
+  } else {
+
+    $i=0;
+    foreach ($newentry as $users => $info){
+      if ($account->ldap_dn == $info['dn']){
+         $entry = $info['attribs'];
+      }
+      $i++;
+    }
   }
 
-  if ($entry = $_ldapdata_ldap->retrieveAttributes($account->ldap_dn)) {
+  if (isset($entry)) {
     $ldap_drupal_reverse_mappings = _ldapdata_reverse_mappings($account->ldap_config);
 
     // Retrieve profile fields list.
Index: ldapsync.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ldap_integration/ldapsync.module,v
retrieving revision 1.1
diff -u -p -r1.1 ldapsync.module
--- ldapsync.module	25 Mar 2010 11:00:16 -0000	1.1
+++ ldapsync.module	3 Jan 2011 00:47:57 -0000
@@ -130,7 +130,12 @@ function _ldapsync_sync() {
     if (function_exists('ldapgroups_user_login')) {
       ldapgroups_user_login($account);
     }
-    
+
+    // Update user's data if ldapdata is enabled.
+    if (function_exists('_ldapdata_user_load')) {
+      _ldapdata_user_load($account, TRUE, $ldap_users);
+    }
+
     // Enable any blocked user who is enabled in LDAP.
     if (!$account->status) {
       db_query("UPDATE {users} SET status = %d where uid = %", 1, $account->uid);
@@ -243,6 +248,7 @@ function _ldapsync_search() {
         $users[$name] = array(
           'dn' => $entry['dn'],
           'mail' => $entry[$mail_attr][0],
+	  'attribs' => $entry,
         );
       }
     }
