Note: You are currently viewing documentation for Moodle 3.6. Up-to-date documentation for the latest stable version of Moodle is likely available here: Download users by role.

Download users by role

From MoodleDocs

Download users by role

Allows an administrator to download a list of users to a comma-separated values format (CSV) or Excel 2007 file format. In addition to the web interface there is also a command line tool located in admin/tool/downloaddata/cli/downloaddata.php.

To download users:

  1. Proceed to Administration > Site administration > Users > Accounts > Download users by role
  2. Select the download options, then click on the download button
Download users by role page
Download users by role page expanded

Instalation

This plugin has been tested to work with Moodle 2.7 and newer. There are no guarantees it will work with earlier versions.

General installation procedures are those common for all Moodle plugins: Installing plugins.

First, you need to choose the branch corresponding to your Moodle version. Then you can choose between cloning the repository, downloading the zip file and extracting it or using the zip file for the plugin install interface accessible at Administration > Site administration > Plugins > Install plugins.

If you choose to clone the repository, then you need to clone it into MOODLE_ROOT_DIRECTORY/admin/tool/downloaddata by specifying the branch. For example, if you have Moodle 3.0 installed:

   git clone -b MOODLE_30_STABLE https://github.com/alexandru-elisei/moodle-tool_downloaddata.git MOODLE_ROOT_DIRECTORY/admin/tool/downloaddata

replacing MOODLE_ROOT_DIRECTORY with the actual Moodle installation root directory path. The zip file should be extracted to the same location.

Keep in mind that cloning the repository also creates a hidden .git directory.

Note: If you decide to use the install plugin interface don't forget to rename the folder inside the archive to downloaddata.

Download options

There are several options to choose from when download the users:

File format
Choose the file format: CSV or Excel 2007.
Encoding
Choose an encoding for the file. Only available when downloading a CSV file.
CSV delimiter
Choose a delimiter for the CSV file fields.
Override fields
Whether to override fields or not. You need to provide you own overrides as a comma separated list of field=value pairs in the 'Overrides' section of the page.

Downloading the file

In order to successfully download the file you need to choose which user fields should be saved and what roles the users should have. You can choose the roles from 'Roles' section of the page and the fields from the 'Fields' section.

Note: The default selected fields are located in admin/tool/downloaddata/config.php.

Likewise, if you have chosen to use overrides, then you similarly need to provide them in the Overrides section of the page as comma separated list of field=override pairs.

User fields

You can choose which fields to be present in the downloaded file in the Fields section. Valid fields are:

id, username, firstname, lastname, email, institution, department, city, country, lang, auth, timezone, idnumber, icq, phone1, phone2, address, url, description, descriptionformat, mailformat, maildisplay, autosubscribe

as well as custom profile fields. You can find out more about what the fields represent on the Upload users page.

As of version 3.0.7 you can also select from a list of user profile fields (if any are defined).

Note: Regardless of the fields specified, each user will have the course and corresponding role fields for all the courses he is enrolled in with the specified role.

User overrides

If you have enabled Use overrides you need to specify the overrides as a comma separated list of field=override pairs in the Overrides section. There are no restrictions on the field names or values.

Note: any values specified here have no effect if the Use overrides option isn't selected.