]> git.mjollnir.org Git - moodle.git/commitdiff
I found a new function: user_has_role_assignment(). Merged from MOODLE_17_STABLE.
authorethem <ethem>
Thu, 26 Oct 2006 14:44:53 +0000 (14:44 +0000)
committerethem <ethem>
Thu, 26 Oct 2006 14:44:53 +0000 (14:44 +0000)
enrol/authorize/uploadcsv.php
enrol/authorize/version.php

index 1dcdeef978becdc31b249db3d87b998aa0a503e6..5b7b1bb8f762e786fb211a5b54cc4d4bf44aec66 100644 (file)
@@ -172,8 +172,7 @@ function authorize_process_csv($filename)
 
         // If user wasn't enrolled, enrol now. Ignore otherwise. Because admin user might submit this file again.
         if ($role = get_default_course_role($course)) {
-            $ra = get_record('role_assignments', 'roleid', $role->id, 'contextid', $coursecontext->id, 'userid', $user->id);
-            if (empty($ra)) { // Not enrolled, so enrol
+            if (! user_has_role_assignment($user->id, $role->id, $coursecontext->id)) {
                 $timestart = $timeend = 0;
                 if ($course->enrolperiod) {
                     $timestart = time();
index 9aa012f225c801faf57ae8eb80643464a711868f..d5f970544b2cd9930b8f402e071ebbb1516c770c 100755 (executable)
@@ -1,6 +1,6 @@
 <?php // $Id$
 
 $plugin->version  = 2006101700;
-$plugin->requires = 2006091700;
+$plugin->requires = 2006100401;
 
 ?>