Index: joomla.module
===================================================================
--- joomla.module	(revision 15)
+++ joomla.module	(working copy)
@@ -356,16 +356,16 @@
 
   //Check Users
 
-  $users_total = 0;
-  $users_updated = 0;
-  $users_new = 0;
-  $users_failed =  0;
+  $accounts_total = 0;
+  $accounts_updated = 0;
+  $accounts_new = 0;
+  $accounts_failed =  0;
 
   db_set_active('joomla');
   $results_user = db_query("SELECT * FROM %susers ORDER BY id", $joomla_prefix);
 
   while ($data = db_fetch_object($results_user)) {
-    $users_total++;
+    $accounts_total++;
 
     db_set_active();
     $uid = db_result(db_query("SELECT uid FROM {joomla_users} WHERE juid = %d", $data->id));
@@ -375,43 +375,43 @@
       continue;
     }
 
-    $user = new stdClass();
+    $account = new stdClass();
 
     // Set uid if we are updating an existing record
     if ($uid) {
-      $user->uid = $uid;
+      $account->uid = $uid;
     }
-    $user->name = $data->username;
-    $user->mail = $data->email;
-    $user->status = !$data->block;
-    $user->created = strtotime($data->registerDate);
-    $user->access = strtotime($data->lastvisitDate);
+    $account->name = $data->username;
+    $account->mail = $data->email;
+    $account->status = !$data->block;
+    $account->created = strtotime($data->registerDate);
+    $account->access = strtotime($data->lastvisitDate);
 
     /**
      * Older versions of Joomla used an unsalted MD5 password hash.  If this
      * is the case we can use this hash as the Drupal password.
      */
     if (strlen($data->password) == 32) {
-      $user->pass = $data->password;
+      $account->pass = $data->password;
     }
 
     $res = FALSE;
     if (!$uid) {
-      $res = drupal_write_record('users', $user);
+      $res = drupal_write_record('users', $account);
     }
     elseif ($joomla_update_duplicate) {
-      $res = drupal_write_record('users', $user, 'uid');
+      $res = drupal_write_record('users', $account, 'uid');
     }
 
     if ($res) {
       // Write into the joomla -> drupal user mapping table
       $joomla_user = new stdClass();
-      $joomla_user->uid = $user->uid;
+      $joomla_user->uid = $account->uid;
       $joomla_user->juid = $data->id;
       $joomla_user->password = $data->password;
 
       // If this is set, than we can consider the users password converted
-      if (!empty($user->pass)) {
+      if (!empty($account->pass)) {
         $joomla_user->converted = 1;
       }
 
@@ -425,7 +425,7 @@
       //Check and Update Realname
       $profile_value = new stdClass();
       $profile_value->fid = $fid;
-      $profile_value->uid = $user->uid;
+      $profile_value->uid = $account->uid;
       $profile_value->value = $data->realname;
 
       if ($uid) {
@@ -438,23 +438,26 @@
 
     switch ($res) {
       case SAVED_NEW:
-        $users_new++;
+        $accounts_new++;
         break;
 
       case SAVED_UPDATED;
-        $users_updated++;
+        $accounts_updated++;
         break;
 
       default:
-        $users_failed++;
+        $accounts_failed++;
         break;
     }
 
-    joomla_sleep($users_total);
+    // Hook to allow other modules to modify the user
+    module_invoke_all('joomla', 'user', $account, $data_joomla->id);
 
+    joomla_sleep($accounts_total);
+
   }
 
-  drupal_set_message(t('Processed @users_total users (@users_new new, @users_updated updated, @users_failed errors)', array('@users_total' => $users_total, '@users_new' => $users_new, '@users_updated' => $users_updated, '@users_failed' => $users_failed)));
+  drupal_set_message(t('Processed @users_total users (@users_new new, @users_updated updated, @users_failed errors)', array('@users_total' => $accounts_total, '@users_new' => $accounts_new, '@users_updated' => $accounts_updated, '@users_failed' => $accounts_failed)));
 }
 
 function joomla_import_categories($joomla_update_duplicate = NULL) {
