--- auth/ldap/auth.php	2009-02-10 22:01:00.000000000 -0600
+++ auth/ldap/auth.php	2009-02-10 21:51:13.000000000 -0600
@@ -735,7 +740,41 @@
 
             unset($revive_users);
         }
+/*
+ *   Switch users that exist in extauth and also users
+ *   that are currently using manual or alternative auth plugin.
+ *    John T. Macklin Remote Learner LLC 2/10/2009 9:26:04 PM viperf117a
+*/
+      print "Validating user authentication method for LDAP users.\n";
+      
+      $sql = "SELECT u.id, u.auth, e.username
+              FROM $temptable e JOIN {$CFG->prefix}user u ON e.username = u.username
+              WHERE u.id IS NOT NULL AND u.auth!='ldap'";
+
+       $mauth_users = get_records_sql($sql); 
 
+        if (!empty($mauth_users)) {
+            print "User entries to update with ldap auth: ". count($mauth_users). "\n";
+
+            begin_sql();
+            foreach ($mauth_users as $user) {
+                 echo "\t";  print_string('auth_dbupdatinguser', 'auth', array($user->username, $user->id)); echo "\n";
+                 
+                 // get the current user record
+                $user = get_record('user', 'username', addslashes($user->username), 'auth', 'manual');
+                if (!empty($user)) {
+
+                     set_field('user', 'auth', 'ldap', 'id', $user->id);
+
+                 }else{
+                    echo "\t"; print 'Cannot switch manual user : '.$user->username.' to LDAP auth!'; echo "\n";
+                 }
+            }
+               commit_sql();
+               unset($mauth_users); // free mem
+        } else {
+            print "No users found to be updated!\n";
+        }
 
 /// User Updates - time-consuming (optional)
         if ($do_updates) {
