]> git.mjollnir.org Git - moodle.git/commitdiff
auth/db: fix fields not read from external database MDL-7712
authormartinlanghoff <martinlanghoff>
Mon, 15 Jan 2007 19:53:26 +0000 (19:53 +0000)
committermartinlanghoff <martinlanghoff>
Mon, 15 Jan 2007 19:53:26 +0000 (19:53 +0000)
auth/db/auth.php

index 0025d0d91764d6b52fdaed2bbc6423a40031d261..124f5f0cc95a55750a48a298b5d0d6b7881b4866 100644 (file)
@@ -121,13 +121,13 @@ class auth_plugin_db {
 
         foreach ($fields as $field) {
             if ($this->config->{'field_map_' . $field}) {
-                if ($rs = $authdb->Execute("SELECT " . $this->config->{'field_map_' . $field} . " FROM {$this->config->table}
+                if ($rs = $authdb->Execute("SELECT " . $this->config->{'field_map_' . $field} . " as myfield FROM {$this->config->table}
                                             WHERE {$this->config->fielduser} = '$username'")) {
                     if ( $rs->RecordCount() == 1 ) {
                         if (!empty($CFG->unicodedb)) {
-                            $result["$field"] = addslashes(stripslashes($rs->fields[0]));
+                            $result["$field"] = addslashes(stripslashes($rs->fields['myfield']));
                         } else {
-                            $result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
+                            $result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields['myfield'])));
                         }
                     }
                 }