]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18746 get_user_courses_bycap() - avoid ambiguous (repeated) column names ; merged...
authorstronk7 <stronk7>
Mon, 11 May 2009 00:04:18 +0000 (00:04 +0000)
committerstronk7 <stronk7>
Mon, 11 May 2009 00:04:18 +0000 (00:04 +0000)
lib/accesslib.php

index dc2c239d6b3782fa6504fec408303bcc5b89dd07..1830ce6f375f4f0a1ed8c6eb8c3a2db275071b72 100755 (executable)
@@ -1069,6 +1069,11 @@ function get_user_courses_bycap($userid, $cap, $accessdata, $doanything, $sort='
     } else {
         $fields = $basefields;
     }
+    // If any of the fields is '*', leave it alone, discarding the rest
+    // to avoid ambiguous columns under some silly DBs. See MDL-18746 :-D
+    if (in_array('*', $fields)) {
+        $fields = array('*');
+    }
     $coursefields = 'c.' .implode(',c.', $fields);
 
     $sort = trim($sort);