Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 39 and 402]

Profile manager class

Copyright: 2020 Adrian Greeve <adrian@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 349 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: profile_manager  - X-Ref

Class for handling interaction with the moodlenet profile.

get_moodlenet_user_profile(int $userid)   X-Ref
Get the mnet profile for a user.

param: int $userid The ID for the user to get the profile form
return: moodlenet_user_profile or null.

save_moodlenet_user_profile(moodlenet_user_profile $moodlenetprofile)   X-Ref
Save the moodlenet profile.

param: moodlenet_user_profile $moodlenetprofile The moodlenet profile to save.

validate_and_fix_missing_profile_items(\stdClass $fielddata)   X-Ref
Checks to see if the required user profile fields and categories are in place. If not it regenerates them.

param: stdClass $fielddata The moodlenet profile field.
return: stdClass The same moodlenet profile field, with any necessary updates made.

get_user_profile_field()   X-Ref
Returns the user profile field table object.

return: stdClass the moodlenet profile table object. False if no record found.

check_profile_category(int $categoryid = null)   X-Ref
This reports back if the category has been deleted or the config value is different.

param: int $categoryid The category id to check against.
return: bool True is the category checks out, otherwise false.

official_profile_exists()   X-Ref
Are we using the proper user profile field to hold the mnet profile?

return: bool True if we are using a user table field for the mnet profile. False means we are using costom profile fields.

get_category_name()   X-Ref
Gets the category name that is set for this site.

return: string The category used to hold the moodle net profile field.

set_category_name(string $categoryname)   X-Ref
Sets the a unique category to hold the moodle net user profile.

param: string $categoryname The base category name to use.
return: string The actual name of the category to use.

create_user_profile_category()   X-Ref
Create a custom user profile category to hold our custom field.

return: int The id of the created category.

set_profile_field_name(string $fieldname)   X-Ref
Sets a unique name to be used for the moodle net profile.

param: string $fieldname The base fieldname to use.
return: string The actual profile field name.

get_profile_field_name()   X-Ref
Gets the unique profile field used to hold the moodle net profile.

return: string The profile field name being used on this site.

create_user_profile_text_field(int $categoryid)   X-Ref
Create a user profile field to hold the moodlenet profile information.

param: int $categoryid The category to put this field into.

get_moodlenet_profile_link(moodlenet_user_profile $moodlenetprofile)   X-Ref
Given our $moodlenetprofile let's cURL the domains' WebFinger endpoint

param: moodlenet_user_profile $moodlenetprofile The moodlenet profile to get info from.
return: array [bool, text, raw]