Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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: 501 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

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
return: void

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.

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
return: array list of fields

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

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

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

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

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()   X-Ref
Returns mapping of all roles using short role name as index.

return: array

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

param: stdClass $data user profile data
return: stdClass pre-processed custom 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

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