Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Bulk user registration functions

Copyright: 2004 onwards Martin Dougiamas (http://dougiamas.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 516 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: uu_progress_tracker  - X-Ref

Tracking of processed users.

This class prints user information into a html table.

__construct()   X-Ref
uu_progress_tracker constructor.


start()   X-Ref
Print table header.

return: void

flush()   X-Ref
Flush previous line and start a new one.

return: void

track($col, $msg, $level = 'normal', $merge = true)   X-Ref
Add tracking info

return: void
param: string $col name of column
param: string $msg message
param: string $level 'normal', 'warning' or 'error'
param: bool $merge true means add as new line, false means override all previous text of the same type

close()   X-Ref
Print the table end

return: void

uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $profilefields, moodle_url $returnurl)   X-Ref
Validation callback function - verified the column line of csv file.
Converts standard column names to lowercase.

return: array list of fields
param: csv_import_reader $cir
param: array $stdfields standard user fields
param: array $profilefields custom profile fields
param: moodle_url $returnurl return url in case of any error

uu_increment_username($username)   X-Ref
Increments username - increments trailing number or adds it if not present.
Varifies that the new username does not exist yet

return: incremented username which does not exist yet
param: string $username

uu_process_template($template, $user)   X-Ref
Check if default field contains templates and apply them.

return: string field value
param: string template - potential tempalte string
param: object user object- we need username, firstname and lastname

uu_process_template_callback($username, $firstname, $lastname, $block)   X-Ref
Internal callback function.


uu_supported_auths()   X-Ref
Returns list of auth plugins that are enabled and known to work.

If ppl want to use some other auth type they have to include it
in the CSV file next on each line.

return: array type=>name

uu_allowed_roles()   X-Ref
Returns list of roles that are assignable in courses

return: array

uu_allowed_roles_cache(?int $categoryid = null, ?int $courseid = null)   X-Ref
Returns assignable roles for current user using short role name and role ID as index.
This function is no longer called without parameters.

return: array
param: int|null $categoryid Id of the category to get roles for.
param: int|null $courseid Id of the course to get roles for.

uu_allowed_sysroles_cache()   X-Ref
Returns mapping of all system roles using short role name as index.

return: array

uu_pre_process_custom_profile_data($data)   X-Ref
Pre process custom profile data, and update it with corrected value

return: stdClass pre-processed custom profile data
param: stdClass $data user profile data

uu_check_custom_profile_data(&$data, array &$profilefieldvalues = [])   X-Ref
Checks if data provided for custom fields is correct
Currently checking for custom profile field or type menu

return: bool true if no error else false
param: array $data user profile data
param: array $profilefieldvalues Used to track previous profile field values to ensure uniqueness is observed