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 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Bulk upload of user pictures Based on .../admin/uploaduser.php and .../lib/gdlib.php

Copyright: (C) 2007 Inaki Arenaza
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 252 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 admin/tool/uploaduser/picture_form.php

Defines 4 functions


Functions that are not part of a class:

my_mktempdir($dir, $prefix='')   X-Ref
Create a unique temporary directory with a given prefix name,
inside a given directory, with given permissions. Return the
full path to the newly created temp directory.

return: string The full path to the temp directory.
param: string $dir where to create the temp directory.
param: string $prefix prefix for the temp directory name (default '')

process_directory($dir, $userfield, $overwrite, &$results)   X-Ref
Recursively process a directory, picking regular files and feeding
them to process_file().

return: nothing
param: string $dir the full path of the directory to process
param: string $userfield the prefix_user table field to use to
param: bool $overwrite overwrite existing picture or not.
param: array $results (by reference) accumulated statistics of

process_file($file, $userfield, $overwrite)   X-Ref
Given the full path of a file, try to find the user the file
corresponds to and assign him/her this file as his/her picture.
Make extensive checks to make sure we don't open any security holes
and report back any success/error.

return: integer either PIX_FILE_UPDATED, PIX_FILE_ERROR or
param: string $file the full path of the file to process
param: string $userfield the prefix_user table field to use to
param: bool $overwrite overwrite existing picture or not.

my_save_profile_image($id, $originalfile)   X-Ref
Try to save the given file (specified by its full path) as the
picture for the user with the given id.

return: mixed new unique revision number or false if not saved
param: integer $id the internal id of the user to assign the
param: string $originalfile the full path of the picture file.