User CSV upload works in 1.9.9, but not in 2.0.2+

User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -
Number of replies: 29

My user CSV upload works in 1.9.9, but not in 2.0.2+.

In 2.0.2, it imports the users, but does not assign to the courses or groups.  The upload confirmation screens says everything uploaded correctly.

In 1.9.9, it imports and assigns correctly.

The CSV is attached.

Average of ratings: -
In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

Upload confirmation attached.  Let me know if you need any more information.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

I turned on dev debugging and no messages showed.

Here is the user profile, showing that they are NOT enrolled in the course:

test5 test5

Picture of test5 test5
Country: United States
City/town: Anytown
Email address: m@m.com
First access: Never
Last access: Never
In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

weirdness continues.  users listed in groups in the courses (see below).

 

...but if I try to access the course as one of the users, it says I'm not enrolled.

So the CSV import is importing the user, creating the group, adding the user to the group, but it is NOT adding them to the course?

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Michelle Leung -

Hi Micky,

 

We have encountered similar problem before.  But, after we updated my Moodle2.02+ on 22 March 2011, we found the problem was fixed.  Please try and hope it works for you too. smile

 

Michelle.

In reply to Michelle Leung

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

Michelle, thank you so much for responding.  I feel that I'm close to completing our testing script.  If I can overcome this issue, we get the green flag to upgrade the production server!

I upgraded using 2.0.2+ code listed on the site March 26th, 2011.  Maybe 2.0.3 will fix it?

More information - TABLES

I thought maybe the user wasn't being linked to the courses correctly in the tables, but they look fine.  Example:

mdl_user, userid = 2138

mdl_user_enrolment, enrollid = 5

mdl_enrol, courseid = 68

however, logging in as that user and going into that course says, "You can not enrol yourself in this course."

Users present in the course prior to the upgrade CAN log into the course.

The self-enrolment plug-in is disabled because we dont' allow self-enrolment at this time.

I will continue to provide any information that you all want to help troubleshoot this issue.

In reply to Michelle Leung

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

Michelle, during the upgrade, what packages were listed as missing from the disk?  My list is below.  I did not install these packages.  However, I resolved all environmental dependencies prior to upgrading (such as php-mod, php-intl, php-soap, etc...using yum install --enablerepo=webtatic in CentOS).

hotpot
journal
lams
admin
admin_tree
loancalc

Thanks Michelle.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

In a moment, i will try to import without assigning to groups, to see how that goes.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

I tried to import the attached file.  Import confirmation didn't state any errors.

Still won't let the student access the course.

I am going to post this to the bug tracker.  What do I do if I want to pay a consultant to solve the problem?

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

FYI - I created a blank database and free moodle 2.0.2+ install.

Still getting the same problem.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Michelle Leung -

Hi Micky,

I amended your csv file and can successfully uploaded to our Moodle2.02+ platform.  Below is the csv file for your reference:

username,password, firstname, lastname, email, course1,group1, type1, course2,group2, type2
test5,test5,test5,test5,m1@m.com,Test Course1,GroupA,1,Test Course2,GroupC,1
test6,test6,test6,test6,m2@m.com,Test Course1,GroupB,1,Test Course2,GroupC,1
testadmin3,testadmin3,testadmin3,testadmin3,m3@m.com,Test Course1,GroupA,2,Test Course2,GroupC,2
testadmin4,testadmin4,testadmin4,testadmin4,m4@m.com,Test Course1,GroupB,2,Test Course2,GroupC,2

I found three areas in your csv that may cause problem:

1.) if you use course1, course2, coursex, then you need to include all corresponding group and type.

2.) for each users, I think the email address should be different.

3.) If the description is empty for all record, I suggest to delete this column.

 

You may try to amend your csv file and upload it to the server again.

 

Michelle.

 

In reply to Michelle Leung

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by William Beazley -

I concur.  I have just used CSV to upload 56 students to existing courses with groups.

The upload from CSV is very brittle and can be derailed with the slightest error in the file.  I had to edit and retry 15 times to get the 56 students uploaded.

Still, its faster than cut and paste.

Bill

In reply to William Beazley

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

Michelle and William, I created the attached csv file, and it still gave me the same error.  Would one of you mind sending me a copy of your CSV files that you have successfully imported?

I really appreciate all your help.

This is a little frustrating because CSV import was a piece of cake in 1.9.9.  Something has changed in 2.0.2+ so it doesn't work.  The CSV that will import in 1.9.9 will not import in 2.0.2+.

Thanks again.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by William Beazley -

I got this test file to upload after these changes:

Remove the leading spaces in course1, type1, etc. (this had no effect)

Remove the trailing space in Test Course 1 name and shortname. (this fixed the enrollment failure.)

See corrected CSV

Bill Beazley

In reply to William Beazley

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

I downloaded your file, changed the usernames and e-mails so they were unique, but it still is causing the enrollment issue.

Just to clarify, the CSV import wizard gives a confirmation that everything uploaded correctly.  However, when logging in afterwards, it says the new account can't enrol at this time.

Is there another setting somewhere in Moodle that would prevent a user from accessing a course even though they are enrolled?

I appreciate all your help.  If you feel pretty confident you could fix it if I setup a GoToMeeting, let me know.  I'd be willing to pay on an hourly basis via paypal or method you choose.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by William Beazley -

This has moved beyond my expertise, sorry.

I suspect there is a unintentional setting in the course, groups, default enrollment OR there is a special character in the upload that is causing the user to look good but be different enough to not log in.

I used to have a similar problem in Joomla that required fields were not completed upon upload: Users were refused login because they haden't completed all fields but could complete them until they confirmed their registration from a non-sent email.  In other words, their sin was not doing what they were never permitted to do.

I am out of ideas.  Sorry

In reply to William Beazley

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

Thanks WIlliams.  Also, I just want to thank everyone who has put time into this issue.  I really respect the support community Moodle has to offer.

Those debugging asked to verify that user is enrolled.  Here are screenshots.

 

 

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

test10 screenshots, per bug tracker request.

 

 

 

 

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

BUG FOUND:   The status for the student was set to Suspended.

Screenshot added for debug.

Screen showing import screen with empty Status column.

 

Import confirmation screen:

 

user can't access course.  Checking status shows it's suspended by default (see below).  Changing to active fixes access problem.

Average of ratings: Useful (1)
In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

WORKAROUND:  After importing via CSV, run SQL code:

UPDATE 'dbname'.'mdl_user_enrolments' SET 'status' = '0';

Unfortunately, I don't know enough about the moodle code to find how this could be done as part of the CSV import process.

Average of ratings: Useful (1)
In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Nicholas Bovee -

Sorry, first ever post to the forums after years of lurking...but this is an issue I need fixed really soon. Your workaround seems like just what I need.

I'm not a programmer, so I was wondering if you could point me in the right direction to find out how I can use your SQL code? Something to do with a database table user_enrolments? Do I just cut and paste your code somewhere? I have admin access and access to the file structure.

I thought mabye I could just add a header "status" in the CSV and add values of "0" signifying active enrolment, but I guess it's not set up to do that.

Apologies in advance if I'm asking something really basic.

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Nicholas Bovee -

Hello again. I now have a basic idea about how to do this with your SQL code, but I found that this problem doesn't exist at all in 2.0.2 (Build: 20110221). Users are enrolled with the default user status of 0, so are "active" without me having to manually change them.

As a bonus, it seems the CSV automatically generates groups in 2.0.2. This didn't seem to be the case in 2.0.2+, in which I had to create groups beforehand with a CSV file.

Are there any serious downsides to using 2.0.2 vs. 2.0.2+? I hope not - I'm having it downgraded to 2.0.2 now.

P.S. I haven't tested 2.0.2 with LDAP, so I'm keeping my fingers crossed.

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

sorry for the delayed post.  I had to put this project on hold for a few days.

I'm testing a possible code fix now.  I'll post in a moment, and also answer your question.

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

For some reason, I have been thinking that 2.0.2+ was supposed to be more stable than 2.0.2.

Regardless, in the bug tracker they found the source of the problem.  I tested it out and so far it's working.

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

, true

(Delete the comma, space and the word true.)

Be careful though, they have not confirmed if this fixes the issue WITHOUT causing issues elsewhere.

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Micky Fokken -

I run SQL commands in PPHMyAdmin.  I use the interface to edit the value manually, then it gives me the code that it uses on the SQL database.  Then, I modify the code so it updates all the rows.

Be careful though.  I didn't proofread my code once and deleted all users from all groups.  I had to manually restore each course's group memberships.

LOL - I tried the status header in the CSV too!  Didn't quite work.

In reply to Micky Fokken

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Nicholas Bovee -

OK, thanks! We've downgraded to 2.0.2 and everything is working fine now. You posted just in the nick of time, though. I would have never figured it out without your help.

Lesson learned: always use the STABLE release! black eye

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by William Beazley -

Bottom Line: CSV User Upload is NOT WORKING beyone 2.02?  After that, It is brocken?

In reply to William Beazley

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers

Interesting discussion here. I too have seen how sensitive some imports are. To a certain extent, this is good in that it prevents faulty data from getting into the system; however, I also know that it can be insanely frustrating to track down such things. I would suggest that a tracker issue be created for what is perceived to be broken in 2.0.2 and please let me know the tracker number of the issue and I'll make a point to watch, vote and test it. I would also suggest that there is room for improvement whereby we might want to trim some of the data coming in to remove spaces automatically and possibly get some more meaningful error messages to help folks track things down. So also file whatever improvement issues in the tracker that you all think would be helpful. Your experience with the user import features can help us to continue to improve the experience for others so that your frustrations are not in vain. Thanks for voicing those concerns and for this discussion which will help to improve this part of Moodle. I admit that I did not read all of the posts carefully (I just skimmed them) but if there are any remaining questions or if I can be of some help just let me know. Peace - Anthony

In reply to Nicholas Bovee

Re: User CSV upload works in 1.9.9, but not in 2.0.2+

by Wan Fareed -

Hi All

I am having this issue as well. I am using Moodle 2.0. I tried out the csv file attached throughout this thread but still have the same problem. I saw this tracker and it seemed that this issue is fixed. So what is it that I am supposed to do to get this fix? Sorry guys...this is such a lamer question.

 

Thanks.