Skip to content

Commit 7cfdd3c

Browse files
MDL-77353 Functions for generating and displaying user details
1 parent 7fea726 commit 7cfdd3c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/apis/core/user/index.md

+30
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,36 @@ Please note that, in many cases, more specific APIs may be more appropriate, for
2121

2222
The [User fields](https://docs.moodle.org/dev/User_fields) class is mainly used when displaying tables of data about users. It indicates which extra fields (e.g. email) should be displayed in the current context based on the permissions of the current user. It also provides ways to get the necessary data from a query, and to obtain other generally-useful fields for user names and pictures.
2323

24+
#### `core_user::get_profile_picture`
25+
26+
Generate user picture.
27+
28+
- **`user`** - The person to get details of.
29+
- **`context`** - The context will be used to determine the visibility of the user's picture.
30+
- **`options`** - Display options to be overridden
31+
- courseid = course id of user profile in link
32+
- size = 35 (size of image)
33+
- link = true (make image clickable - the link leads to user profile)
34+
- popup = false (open in popup)
35+
- alttext = true (add image alt attribute)
36+
- class = image class attribute (default 'userpicture')
37+
- visibletoscreenreaders = true (whether to be visible to screen readers)
38+
- includefullname = false (whether to include the user's full name together with the user picture)
39+
- includetoken = false (whether to use a token for authentication. True for current user, int value for other user id)
40+
41+
#### `core_user::get_profile_url`
42+
Generate profile url.
43+
44+
- **`user`** - The person to get details of.
45+
- **`context`** - The context will be used to determine the visibility of the user's full name.
46+
47+
#### `core_user::get_fullname`
48+
Generate user full name.
49+
50+
- **`user`** - the person to get details of.
51+
- **`context`** - The context will be used to determine the visibility of the user's profile url.
52+
- **`options`** - Can include: override - if true, will not use forced firstname/lastname settings
53+
2454
## User fields definition
2555

2656
To guarantee the sanity of the data inserted into Moodle and avoid security bugs, new user fields definition methods have been created for use in Moodle 3.1 onwards. The purpose of these new methods is to create a central point of user fields data validation and guarantee all data inserted into Moodle will be cleaned against the correct parameter type. Another goal of this new API is to create consistency across Moodle core and avoid different parameter validations for the same user fields. For now on, user data must validate against the user field, not using clean_param() directly.

0 commit comments

Comments
 (0)