Moodle
  1. Moodle
  2. MDL-27007

Users created via CSV upload cannot access courses

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Administration, Enrolments
    • Labels:
    • Environment:
      CentOS 5.4
      OS CentOS 5.4
      Kernel 2.6.18-194.32.1.el5
      PHP version: PHP v5.3.6
      MySQL version: 5.0.77
      Apache 2.2.3
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      17041

      Description

      1. Create blank database
      2. Download and install Moodle 2.0.2+ (March 25th version)
      3. Create TEST course > Topics Format > start date (today)
      4. Disable password security
      5. Import using attached CSV file
      6. Import confirmation page says user is imported and added to TEST course
      7. Logout as admin. Login as imported user
      8. Click on course
      9. Moodle states "You can not enrol yourself in this course"

        Activity

        Hide
        Mary Cooch added a comment -

        I just tried your csv file on the QA Moodle and got the same results as you.

        Show
        Mary Cooch added a comment - I just tried your csv file on the QA Moodle and got the same results as you.
        Hide
        Micky Fokken added a comment -

        Is it a problem with the CSV format? BTW - this same CSV file works in my production server - Moodle 1.9.9.

        If there is anything I can do to help, let me know.

        Show
        Micky Fokken added a comment - Is it a problem with the CSV format? BTW - this same CSV file works in my production server - Moodle 1.9.9. If there is anything I can do to help, let me know.
        Hide
        Helen Foster added a comment -

        Micky, thanks for your report, and Mary, thanks for confirming that the problem is reproducible on http://qa.moodle.net.

        Just adding a link to the forum discussion about this issue http://moodle.org/mod/forum/discuss.php?d=172026 and adding Petr as a watcher since he's made lots of improvements to Upload users in Moodle 2.0.

        Show
        Helen Foster added a comment - Micky, thanks for your report, and Mary, thanks for confirming that the problem is reproducible on http://qa.moodle.net . Just adding a link to the forum discussion about this issue http://moodle.org/mod/forum/discuss.php?d=172026 and adding Petr as a watcher since he's made lots of improvements to Upload users in Moodle 2.0.
        Hide
        Petr Škoda added a comment -

        It works fine for me, please verify the user enrolment in the list of enrolled users.

        Show
        Petr Škoda added a comment - It works fine for me, please verify the user enrolment in the list of enrolled users.
        Hide
        Micky Fokken added a comment -

        User is enrolled. Posted new screenshots to forum discussion showing enrollment, course access deny and course settings.

        Show
        Micky Fokken added a comment - User is enrolled. Posted new screenshots to forum discussion showing enrollment, course access deny and course settings.
        Hide
        Micky Fokken added a comment -

        Screenshots show user test5, but the same problem applies. If you need test10 (user listed in csv file) screenshots, let me know and I'll upload.

        Show
        Micky Fokken added a comment - Screenshots show user test5, but the same problem applies. If you need test10 (user listed in csv file) screenshots, let me know and I'll upload.
        Hide
        Petr Škoda added a comment -

        If user is enrolled and the enrolment is active (unfortunately your screenshots do not show the enrol info on the right side of the enrol table) it should not display "You can not enrol yourself in this course". Are you sure you are trying to access the same course?

        Show
        Petr Škoda added a comment - If user is enrolled and the enrolment is active (unfortunately your screenshots do not show the enrol info on the right side of the enrol table) it should not display "You can not enrol yourself in this course". Are you sure you are trying to access the same course?
        Hide
        Micky Fokken added a comment - - edited

        I posted new full screen screenshots for test10, the user listed in the CSV file.

        Yes, I'm certain it's the same course. The new screenshots show the entire screen. Thank you.

        Show
        Micky Fokken added a comment - - edited I posted new full screen screenshots for test10, the user listed in the CSV file. Yes, I'm certain it's the same course. The new screenshots show the entire screen. Thank you.
        Hide
        Petr Škoda added a comment -

        The screenshot says that the user enrolment is disabled (gray colour) and the enrol manual instance is enbaled. This is strange, there should not be any code suspending the enrolments.

        Show
        Petr Škoda added a comment - The screenshot says that the user enrolment is disabled (gray colour) and the enrol manual instance is enbaled. This is strange, there should not be any code suspending the enrolments.
        Hide
        Micky Fokken added a comment -

        Good catch. I updated the forum post. Changing to active fixes it. I updated the remaining user via MySQL command. This workaround will work for now.

        Is this occurring on http://qa.moodle.net?

        Show
        Micky Fokken added a comment - Good catch. I updated the forum post. Changing to active fixes it. I updated the remaining user via MySQL command. This workaround will work for now. Is this occurring on http://qa.moodle.net?
        Hide
        Chaim Schendowich added a comment -

        The reason for the problem is thus:

        If you try to edit the enrollment you will get to a form in which there is the option 'status'. It will be in the state "suspended". The reason for this is that in the database the value of 'status' in 'user_enrolments' is equal to 1 (as can be seen in the file "enrol/users_forms.php" in the class "enrol_users_edit_form").

        When uploading a CSV file, the page "admin/uploaduser.php" calls (line 768) to the function "enrol_user" with the status set to "true". This function which is in "lib/enrollib.php" sets the status to 0 (in lines 1041, 1072) as default, though since here "true" is sent by argument it is the value used. That is the reason all users uploaded by CSV are automatically suspended.

        A simple way to resolve this problem is to simply erase the last argument in "enrol_user" in "admin/uploaduser.php" (line 768).

        Show
        Chaim Schendowich added a comment - The reason for the problem is thus: If you try to edit the enrollment you will get to a form in which there is the option 'status'. It will be in the state "suspended". The reason for this is that in the database the value of 'status' in 'user_enrolments' is equal to 1 (as can be seen in the file "enrol/users_forms.php" in the class "enrol_users_edit_form"). When uploading a CSV file, the page "admin/uploaduser.php" calls (line 768) to the function "enrol_user" with the status set to "true". This function which is in "lib/enrollib.php" sets the status to 0 (in lines 1041, 1072) as default, though since here "true" is sent by argument it is the value used. That is the reason all users uploaded by CSV are automatically suspended. A simple way to resolve this problem is to simply erase the last argument in "enrol_user" in "admin/uploaduser.php" (line 768).
        Hide
        Petr Škoda added a comment -

        Oops, my fault that surfaced after the recent change in API done by Jerome, thanks a lot!!
        I am going to review all similar places again and fix them if necessary.

        Show
        Petr Škoda added a comment - Oops, my fault that surfaced after the recent change in API done by Jerome, thanks a lot!! I am going to review all similar places again and fix them if necessary.
        Hide
        Micky Fokken added a comment -

        I deleted the following from admin/uploaduser.php (line 768)

        , true

        The users are now enrolling in the course in Active mode.

        Think this change have negative repercussions anywhere else in the code?

        I'll resume my upgrade testing script and see if I find anything else. I'll also update the forum post.

        Thanks everyone.

        Show
        Micky Fokken added a comment - I deleted the following from admin/uploaduser.php (line 768) , true The users are now enrolling in the course in Active mode. Think this change have negative repercussions anywhere else in the code? I'll resume my upgrade testing script and see if I find anything else. I'll also update the forum post. Thanks everyone.
        Hide
        Petr Škoda added a comment -

        This issue should be fixed in the next weekly build, thanks a lot everybody and sorry for the trouble.

        Petr

        Show
        Petr Škoda added a comment - This issue should be fixed in the next weekly build, thanks a lot everybody and sorry for the trouble. Petr
        Hide
        Micky Fokken added a comment -

        Thanks everyone. It's great being part of this community.

        Show
        Micky Fokken added a comment - Thanks everyone. It's great being part of this community.
        Hide
        Ray Lawrence added a comment -

        Hi,

        Still present in Moodle 2.0.2+ (Build: 20110406)

        I see fix verion is 2.0.3. Needs a fix in 2.0.2.

        Show
        Ray Lawrence added a comment - Hi, Still present in Moodle 2.0.2+ (Build: 20110406) I see fix verion is 2.0.3. Needs a fix in 2.0.2.
        Hide
        Petr Škoda added a comment - - edited

        please test current weekly, previous weekly is not fixed

        petr

        Show
        Petr Škoda added a comment - - edited please test current weekly, previous weekly is not fixed petr

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: