MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making the code completely horrible. For example, there are many instances where it would probably be better to rewrite a query entirely, but I have not done that (in order to reduce the risk of changes).
This commit is contained in:
+4
-14
@@ -252,20 +252,10 @@ class core_user {
|
||||
$extraparams = [];
|
||||
|
||||
// TODO Does not support custom user profile fields (MDL-70456).
|
||||
$extra = \core\user_fields::get_identity_fields(null, false);
|
||||
|
||||
// We need the username just to skip guests.
|
||||
$extrafieldlist = $extra;
|
||||
if (!in_array('username', $extra)) {
|
||||
$extrafieldlist[] = 'username';
|
||||
}
|
||||
// The deleted flag will always be false because users_search_sql excludes deleted users,
|
||||
// but it must be present or it causes PHP warnings in some functions below.
|
||||
if (!in_array('deleted', $extra)) {
|
||||
$extrafieldlist[] = 'deleted';
|
||||
}
|
||||
$selectfields = \user_picture::fields('u',
|
||||
array_merge(get_all_user_name_fields(), $extrafieldlist));
|
||||
$userfieldsapi = \core\user_fields::for_identity(null, false)->with_userpic()->with_name()
|
||||
->including('username', 'deleted');
|
||||
$selectfields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
|
||||
$extra = $userfieldsapi->get_required_fields([\core\user_fields::PURPOSE_IDENTITY]);
|
||||
|
||||
$index = 1;
|
||||
foreach ($extra as $fieldname) {
|
||||
|
||||
Reference in New Issue
Block a user