Note: You are currently viewing documentation for Moodle 3.4. 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
Revision as of 16:30, 9 December 2015 by Alexandru Elisei (talk | contribs)
Download users by role
Type tool
Set N/A
Downloads To be created upon submission
Issues https://github.com/alexandru-elisei/moodle-tool_downloaddata/issues
Discussion To be created upon submission
Maintainer(s) Alexandru Elisei

Download users

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
File:download users page.png
Download users page

Instalation

This plugin has been tested to work with Moodle 2.7 and newer. There are no guarantess 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:

Roles
The roles that you want the downloaded users to have. Users that have this role will be saved with only this role specified, meaning that other roles won't be saved. If you want to save the users with all their roles, choose All.
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.
Use defaults
Whether to use the default fields and overrides (if the option is selected) provided in admin/tool/downloaddata/config.php.
Override fields
Whether to override fields or not. You can either use the overrides provided in admin/tool/downloaddata/config.php by selecting Use defaults or provide you own overrides as a comma separated list of field=value pairs. Note: by default there are no overrides specified in the admin/tool/downloaddata/config.php file.

Downloading the file

In order to successfully download the file you need to specify which user fields should be saved. This can be done by either choosing Use defaults and providing the fields in the admin/tool/downloaddata/config.php file or manually specifying them in the Fields section of the page.

Likewise, if you have chosen to use overrides, then you similarly need to provide them in the admin/tool/downloaddata/config.php file or in the Overrides section of the page.

User fields

You can specify which fields to be present in the downloaded file in the Fields section as a comma separated list of valid field names. 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.

The fields specified here will take precedence over the default fields from admin/tool/downloaddata/config.php even if the Use defaults option was selected.

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 can 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. Any data specified here will take precedence over the overrides from admin/tool/downloaddata/config.php file. Note: any values specified here have no effect if the Use overrides option isn't selected.