Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

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: 531 lines (18 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(?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.

param: int|null $categoryid Id of the category to get roles for.
param: int|null $courseid Id of the course to get roles for.
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