Downloading Users including courses

Downloading Users including courses

by Ira Bailey -
Number of replies: 1

Is there any way to download users in a csv or xls format that includes courses? If only the download users format was the same as the upload!!

Using Moodle 2.4.

Average of ratings: -
In reply to Ira Bailey

Re: Downloading Users including courses

by Ira Bailey -

Just looked at users_bulk_download.php and it seems to get data from the 'mdl_users' table to implement this:

...

if ($format) {
    $fields = array('id'        => 'id',
                    'username'  => 'username',
                    'email'     => 'email',
                    'firstname' => 'firstname',
                    'lastname'  => 'lastname',
                    'idnumber'  => 'idnumber',
                    'institution' => 'institution',
                    'department' => 'department',
                    'phone1'    => 'phone1',
                    'phone2'    => 'phone2',
                    'city'      => 'city',
                    'url'       => 'url',
                    'icq'       => 'icq',
                    'skype'     => 'skype',
                    'aim'       => 'aim',
                    'yahoo'     => 'yahoo',
                    'msn'       => 'msn',
                    'country'   => 'country');

The reason why it can't do course information is that there is no course data in 'mdl_users', it's in 'mdl_users_enrolment'.

I can't seem to work out what the data is though. The fields in 'mdl_users_enrolment' are: id,status,enrolid,userid,timestart,timeend,modifierid,timecreated,timemodified

But can't understand the enrolid, it doesn't map to the course number...

Any ideas? I'll try to hack up a download php script that will get the course info..