Commit 558cc1b8 authored by sam marshall's avatar sam marshall
Browse files

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).
parent 3f003455
......@@ -372,7 +372,8 @@ function chat_print_recent_activity($course, $viewfullnames, $timestart) {
$groupselect = "";
}
$userfields = user_picture::fields('u');
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
if (!$users = $DB->get_records_sql("SELECT $userfields
FROM {course_modules} cm
JOIN {chat} ch ON ch.id = cm.instance
......@@ -513,7 +514,8 @@ function chat_get_users($chatid, $groupid=0, $groupingid=0) {
$groupingjoin = '';
}
$ufields = user_picture::fields('u');
$userfieldsapi = \core\user_fields::for_userpic();
$ufields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
return $DB->get_records_sql("SELECT DISTINCT $ufields, c.lastmessageping, c.firstping
FROM {chat_users} c
JOIN {user} u ON u.id = c.userid $groupingjoin
......@@ -905,7 +907,7 @@ function chat_format_message($message, $courseid, $currentuser, $chatlastrow=nul
if (isset($users[$message->userid])) {
$user = $users[$message->userid];
} else if ($user = $DB->get_record('user', array('id' => $message->userid), user_picture::fields())) {
} else if ($user = $DB->get_record('user', array('id' => $message->userid), implode(',', \core\user_fields::get_picture_fields()))) {
$users[$message->userid] = $user;
} else {
return null;
......@@ -936,7 +938,7 @@ function chat_format_message_theme ($message, $chatuser, $currentuser, $grouping
if (isset($users[$message->userid])) {
$sender = $users[$message->userid];
} else if ($sender = $DB->get_record('user', array('id' => $message->userid), user_picture::fields())) {
} else if ($sender = $DB->get_record('user', array('id' => $message->userid), implode(',', \core\user_fields::get_picture_fields()))) {
$users[$message->userid] = $sender;
} else {
return null;
......
......@@ -798,9 +798,11 @@ function choice_get_response_data($choice, $cm, $groupmode, $onlyactive) {
/// First get all the users who have access here
/// To start with we assume they are all "unanswered" then move them later
$extrafields = get_extra_user_fields($context);
// TODO Does not support custom user profile fields (MDL-70456).
$userfieldsapi = \core\user_fields::for_identity($context, false)->with_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$allresponses[0] = get_enrolled_users($context, 'mod/choice:choose', $currentgroup,
user_picture::fields('u', $extrafields), null, 0, 0, $onlyactive);
$userfields, null, 0, 0, $onlyactive);
/// Get all the recorded responses for this choice
$rawresponses = $DB->get_records('choice_answers', array('choiceid' => $choice->id));
......
......@@ -95,7 +95,8 @@
$users = choice_get_response_data($choice, $cm, $groupmode, $onlyactive);
$extrafields = get_extra_user_fields($context);
// TODO Does not support custom user profile fields (MDL-70456).
$extrafields = \core\user_fields::get_identity_fields($context, false);
if ($download == "ods" && has_capability('mod/choice:downloadresponses', $context)) {
require_once("$CFG->libdir/odslib.class.php");
......@@ -118,7 +119,7 @@
// Add headers for extra user fields.
foreach ($extrafields as $field) {
$myxls->write_string(0, $i++, get_user_field_name($field));
$myxls->write_string(0, $i++, \core\user_fields::get_display_name($field));
}
$myxls->write_string(0, $i++, get_string("group"));
......@@ -179,7 +180,7 @@
// Add headers for extra user fields.
foreach ($extrafields as $field) {
$myxls->write_string(0, $i++, get_user_field_name($field));
$myxls->write_string(0, $i++, \core\user_fields::get_display_name($field));
}
$myxls->write_string(0, $i++, get_string("group"));
......@@ -235,7 +236,7 @@
// Add headers for extra user fields.
foreach ($extrafields as $field) {
echo get_user_field_name($field) . "\t";
echo \core\user_fields::get_display_name($field) . "\t";
}
echo get_string("group"). "\t";
......
......@@ -4118,9 +4118,8 @@ function data_get_recordids($alias, $searcharray, $dataid, $recordids) {
function data_get_advanced_search_sql($sort, $data, $recordids, $selectdata, $sortorder) {
global $DB;
$namefields = user_picture::fields('u');
// Remove the id from the string. This already exists in the sql statement.
$namefields = str_replace('u.id,', '', $namefields);
$userfieldsapi = \core\user_fields::for_userpic()->excluding('id');
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
if ($sort == 0) {
$nestselectsql = 'SELECT r.id, r.approved, r.timecreated, r.timemodified, r.userid, ' . $namefields . '
......
......@@ -1112,9 +1112,8 @@ function data_search_entries($data, $cm, $context, $mode, $currentgroup, $search
$advparams = array();
// This is used for the initial reduction of advanced search results with required entries.
$entrysql = '';
$namefields = user_picture::fields('u');
// Remove the id from the string. This already exists in the sql statement.
$namefields = str_replace('u.id,', '', $namefields);
$userfieldsapi = \core\user_fields::for_userpic()->excluding('id');
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
// Find the field we are sorting on.
if ($sort <= 0 or !$sortfield = data_get_field_from_id($sort, $data)) {
......
......@@ -62,7 +62,8 @@ $presets = data_get_available_presets($context);
$strdelete = get_string('deleted', 'data');
foreach ($presets as &$preset) {
if (!empty($preset->userid)) {
$namefields = get_all_user_name_fields(true);
$userfieldsapi = \core\user_fields::for_name();
$namefields = $userfieldsapi->get_sql('', false, '', '', false)->selects;
$presetuser = $DB->get_record('user', array('id' => $preset->userid), 'id, ' . $namefields, MUST_EXIST);
$preset->description = $preset->name.' ('.fullname($presetuser, true).')';
} else {
......
......@@ -294,9 +294,8 @@
echo $OUTPUT->notification(get_string('recorddeleted','data'), 'notifysuccess');
}
} else { // Print a confirmation page
$allnamefields = user_picture::fields('u');
// Remove the id from the string. This already exists in the sql statement.
$allnamefields = str_replace('u.id,', '', $allnamefields);
$userfieldsapi = \core\user_fields::for_userpic()->excluding('id');
$allnamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$dbparams = array($delete);
if ($deleterecord = $DB->get_record_sql("SELECT dr.*, $allnamefields
FROM {data_records} dr
......@@ -332,9 +331,8 @@
$validrecords = array();
$recordids = array();
foreach ($multidelete as $value) {
$allnamefields = user_picture::fields('u');
// Remove the id from the string. This already exists in the sql statement.
$allnamefields = str_replace('u.id,', '', $allnamefields);
$userfieldsapi = \core\user_fields::for_userpic()->excluding('id');
$allnamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$dbparams = array('id' => $value);
if ($deleterecord = $DB->get_record_sql("SELECT dr.*, $allnamefields
FROM {data_records} dr
......
......@@ -120,8 +120,10 @@ class mod_feedback_responses_table extends table_sql {
get_string('groups')
);
$extrafields = get_extra_user_fields($this->get_context());
$ufields = user_picture::fields('u', $extrafields, $this->useridfield);
// TODO Does not support custom user profile fields (MDL-70456).
$userfieldsapi = \core\user_fields::for_identity($this->get_context(), false)->with_userpic();
$ufields = $userfieldsapi->get_sql('u', false, '', $this->useridfield, false)->selects;
$extrafields = $userfieldsapi->get_required_fields([\core\user_fields::PURPOSE_IDENTITY]);
$fields = 'c.id, c.timemodified as completed_timemodified, c.courseid, '.$ufields;
$from = '{feedback_completed} c '
. 'JOIN {user} u ON u.id = c.userid AND u.deleted = :notdeleted';
......@@ -141,7 +143,7 @@ class mod_feedback_responses_table extends table_sql {
foreach ($extrafields as $field) {
$fields .= ", u.{$field}";
$tablecolumns[] = $field;
$tableheaders[] = get_user_field_name($field);
$tableheaders[] = \core\user_fields::get_display_name($field);
}
}
......
......@@ -388,7 +388,8 @@ function feedback_get_recent_mod_activity(&$activities, &$index,
$sqlargs = array();
$userfields = user_picture::fields('u', null, 'useridagain');
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', 'useridagain', false)->selects;
$sql = " SELECT fk . * , fc . * , $userfields
FROM {feedback_completed} fc
JOIN {feedback} fk ON fk.id = fc.feedback
......@@ -985,7 +986,8 @@ function feedback_get_incomplete_users(cm_info $cm,
//first get all user who can complete this feedback
$cap = 'mod/feedback:complete';
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$fields = 'u.id, ' . $allnames . ', u.picture, u.email, u.imagealt';
if (!$allusers = get_users_by_capability($context,
$cap,
......@@ -1122,7 +1124,8 @@ function feedback_get_complete_users($cm,
$sortsql = '';
}
$ufields = user_picture::fields('u');
$userfieldsapi = \core\user_fields::for_userpic();
$ufields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$sql = 'SELECT DISTINCT '.$ufields.', c.timemodified as completed_timemodified
FROM {user} u, {feedback_completed} c '.$fromgroup.'
WHERE '.$where.' anonymous_response = :anon
......
......@@ -57,7 +57,8 @@ class export_form extends \moodleform {
'valuehtmlcallback' => function($value) {
global $OUTPUT;
$allusernames = get_all_user_name_fields(true);
$userfieldsapi = \core\user_fields::for_name();
$allusernames = $userfieldsapi->get_sql('', false, '', '', false)->selects;
$fields = 'id, ' . $allusernames;
$user = \core_user::get_user($value, $fields);
$useroptiondata = [
......
......@@ -131,8 +131,11 @@ class discussion_list extends db_table_vault {
// - Most recent editor.
$thistable = new dml_table(self::TABLE, $alias, $alias);
$posttable = new dml_table('forum_posts', 'fp', 'p_');
$firstauthorfields = \user_picture::fields('fa', ['deleted'], self::FIRST_AUTHOR_ID_ALIAS, self::FIRST_AUTHOR_ALIAS);
$latestuserfields = \user_picture::fields('la', ['deleted'], self::LATEST_AUTHOR_ID_ALIAS, self::LATEST_AUTHOR_ALIAS);
$userfieldsapi = \core\user_fields::for_userpic()->including('deleted');
$firstauthorfields = $userfieldsapi->get_sql('fa', false,
self::FIRST_AUTHOR_ALIAS, self::FIRST_AUTHOR_ID_ALIAS, false)->selects;
$latestuserfields = $userfieldsapi->get_sql('la', false,
self::LATEST_AUTHOR_ALIAS, self::LATEST_AUTHOR_ID_ALIAS, false)->selects;
$fields = implode(', ', [
$thistable->get_field_select(),
......@@ -271,7 +274,7 @@ class discussion_list extends db_table_vault {
$nameformat = get_string('fullnamedisplay', '', (object)['firstname' => 'firstname', 'lastname' => 'lastname']);
}
// Fetch all the available user name fields.
$availablefields = order_in_string(get_all_user_name_fields(), $nameformat);
$availablefields = order_in_string(\core\user_fields::get_name_fields(), $nameformat);
// We'll default to the first name if there's no available name field.
$returnfield = 'firstname';
if (!empty($availablefields)) {
......
......@@ -393,7 +393,8 @@ class subscriptions {
global $CFG, $DB;
if (empty($fields)) {
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$fields ="u.id,
u.username,
$allnames,
......
......@@ -839,7 +839,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa
// Build an object that represents the posting user
$postuser = new stdClass;
$postuserfields = explode(',', user_picture::fields());
$postuserfields = explode(',', implode(',', \core\user_fields::get_picture_fields()));
$postuser = username_load_fields_from_object($postuser, $post, null, $postuserfields);
$postuser->id = $post->userid;
$postuser->fullname = fullname($postuser, $cm->cache->caps['moodle/site:viewfullnames']);
......
......@@ -674,7 +674,7 @@ class mod_forum_external extends external_api {
$discussion->usermodifiedfullname = null;
$discussion->usermodifiedpictureurl = null;
} else {
$picturefields = explode(',', user_picture::fields());
$picturefields = explode(',', implode(',', \core\user_fields::get_picture_fields()));
// Load user objects from the results of the query.
$user = new stdclass();
......
......@@ -644,7 +644,8 @@ function forum_print_recent_activity($course, $viewfullnames, $timestart) {
// do not use log table if possible, it may be huge and is expensive to join with other tables
$allnamefields = user_picture::fields('u', null, 'duserid');
$userfieldsapi = \core\user_fields::for_userpic();
$allnamefields = $userfieldsapi->get_sql('u', false, '', 'duserid', false)->selects;
if (!$posts = $DB->get_records_sql("SELECT p.*,
f.course, f.type AS forumtype, f.name AS forumname, f.intro, f.introformat, f.duedate,
f.cutoffdate, f.assessed AS forumassessed, f.assesstimestart, f.assesstimefinish,
......@@ -971,7 +972,8 @@ function forum_scale_used_anywhere(int $scaleid): bool {
function forum_get_post_full($postid) {
global $CFG, $DB;
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
return $DB->get_record_sql("SELECT p.*, d.forum, $allnames, u.email, u.picture, u.imagealt
FROM {forum_posts} p
JOIN {forum_discussions} d ON p.discussion = d.id
......@@ -1000,7 +1002,8 @@ function forum_get_all_discussion_posts($discussionid, $sort, $tracking = false)
$params[] = $USER->id;
}
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$params[] = $discussionid;
if (!$posts = $DB->get_records_sql("SELECT p.*, $allnames, u.email, u.picture, u.imagealt $tr_sel
FROM {forum_posts} p
......@@ -1298,7 +1301,8 @@ function forum_search_posts($searchterms, $courseid=0, $limitfrom=0, $limitnum=5
FROM $fromsql
WHERE $selectsql";
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$searchsql = "SELECT p.*,
d.forum,
$allnames,
......@@ -1338,7 +1342,8 @@ function forum_get_user_posts($forumid, $userid) {
}
}
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
return $DB->get_records_sql("SELECT p.*, d.forum, $allnames, u.email, u.picture, u.imagealt
FROM {forum} f
JOIN {forum_discussions} d ON d.forum = f.id
......@@ -1429,7 +1434,8 @@ function forum_count_user_posts($forumid, $userid) {
function forum_get_post_from_log($log) {
global $CFG, $DB;
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
if ($log->action == "add post") {
return $DB->get_record_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid, $allnames, u.email, u.picture
......@@ -1757,11 +1763,13 @@ function forum_get_discussions($cm, $forumsort="", $fullpost=true, $unused=-1, $
$postdata = "p.*";
}
$userfieldsapi = \core\user_fields::for_name();
if (empty($userlastmodified)) { // We don't need to know this
$umfields = "";
$umtable = "";
} else {
$umfields = ', ' . get_all_user_name_fields(true, 'um', null, 'um') . ', um.email AS umemail, um.picture AS umpicture,
$umfields = $userfieldsapi->get_sql('um', false, 'um')->selects . ', um.email AS umemail, um.picture AS umpicture,
um.imagealt AS umimagealt';
$umtable = " LEFT JOIN {user} um ON (d.usermodified = um.id)";
}
......@@ -1775,7 +1783,7 @@ function forum_get_discussions($cm, $forumsort="", $fullpost=true, $unused=-1, $
$discussionfields = "d.id as discussionid, d.course, d.forum, d.name, d.firstpost, d.groupid, d.assessed," .
" d.timemodified, d.usermodified, d.timestart, d.timeend, d.pinned, d.timelocked";
$allnames = get_all_user_name_fields(true, 'u');
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$sql = "SELECT $postdata, $discussionfields,
$allnames, u.email, u.picture, u.imagealt $umfields
FROM {forum_discussions} d
......@@ -2431,7 +2439,7 @@ function forum_print_discussion_header(&$post, $forum, $group = -1, $datestring
// Picture
$postuser = new stdClass();
$postuserfields = explode(',', user_picture::fields());
$postuserfields = explode(',', implode(',', \core\user_fields::get_picture_fields()));
$postuser = username_load_fields_from_object($postuser, $post, null, $postuserfields);
$postuser->id = $post->userid;
echo '<td class="author">';
......@@ -4106,7 +4114,8 @@ function forum_get_recent_mod_activity(&$activities, &$index, $timestart, $cours
$groupselect = "";
}
$allnames = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$allnames = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
if (!$posts = $DB->get_records_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,
d.timestart, d.timeend, d.userid AS duserid,
$allnames, u.email, u.picture, u.imagealt, u.email
......@@ -4178,7 +4187,7 @@ function forum_get_recent_mod_activity(&$activities, &$index, $timestart, $cours
$tmpactivity->user = new stdClass();
$additionalfields = array('id' => 'userid', 'picture', 'imagealt', 'email');
$additionalfields = explode(',', user_picture::fields());
$additionalfields = explode(',', implode(',', \core\user_fields::get_picture_fields()));
$tmpactivity->user = username_load_fields_from_object($tmpactivity->user, $post, null, $additionalfields);
$tmpactivity->user->id = $post->userid;
......@@ -6015,7 +6024,8 @@ function forum_get_posts_by_user($user, array $courses, $musthaveaccess = false,
// Prepare SQL to both count and search.
// We alias user.id to useridx because we forum_posts already has a userid field and not aliasing this would break
// oracle and mssql.
$userfields = user_picture::fields('u', null, 'useridx');
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', 'useridx', false)->selects;
$countsql = 'SELECT COUNT(*) ';
$selectsql = 'SELECT p.*, d.forum, d.name AS discussionname, '.$userfields.' ';
$wheresql = implode(" OR ", $forumsearchwhere);
......
......@@ -125,7 +125,8 @@ class mod_forum_renderer extends plugin_renderer_base {
$output .= $this->output->heading(get_string("invalidmodule", "error"));
} else {
$cm = $modinfo->instances['forum'][$forum->id];
$canviewemail = in_array('email', get_extra_user_fields(context_module::instance($cm->id)));
// TODO Does not support custom user profile fields (MDL-70456).
$canviewemail = in_array('email', \core\user_fields::get_identity_fields(context_module::instance($cm->id), false));
$strparams = new stdclass();
$strparams->name = format_string($forum->name);
$strparams->count = count($users);
......
......@@ -543,8 +543,9 @@ class summary_table extends table_sql {
protected function define_base_sql(): void {
global $USER;
$userfields = get_extra_user_fields($this->userfieldscontext);
$userfieldssql = \user_picture::fields('u', $userfields);
// TODO Does not support custom user profile fields (MDL-70456).
$userfieldsapi = \core\user_fields::for_identity($this->userfieldscontext, false)->with_userpic();
$userfieldssql = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
// Define base SQL query format.
$this->sql->basefields = ' ue.userid AS userid,
......
......@@ -182,7 +182,8 @@ function forum_rss_feed_discussions_sql($forum, $cm, $newsince=0) {
$forumsort = "d.timemodified DESC";
$postdata = "p.id AS postid, p.subject, p.created as postcreated, p.modified, p.discussion, p.userid, p.message as postmessage, p.messageformat AS postformat, p.messagetrust AS posttrust";
$userpicturefields = user_picture::fields('u', null, 'userid');
$userfieldsapi = \core\user_fields::for_userpic();
$userpicturefields = $userfieldsapi->get_sql('u', false, '', 'userid', false)->selects;
$sql = "SELECT $postdata, d.id as discussionid, d.name as discussionname, d.timemodified, d.usermodified, d.groupid,
d.timestart, d.timeend, $userpicturefields
......@@ -235,7 +236,8 @@ function forum_rss_feed_posts_sql($forum, $cm, $newsince=0) {
$privatewhere = '';
}
$usernamefields = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$usernamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$sql = "SELECT p.id AS postid,
d.id AS discussionid,
d.name AS discussionname,
......
......@@ -117,7 +117,9 @@ class mod_glossary_entry_query_builder {
* @return void
*/
public function add_user_fields() {
$this->fields[] = user_picture::fields('u', null, 'userdataid', 'userdata');
$userfieldsapi = \core\user_fields::for_userpic();
$fields = $userfieldsapi->get_sql('u', false, 'userdata', '', false)->selects;
$this->fields[] = $fields;
}
/**
......
......@@ -403,7 +403,8 @@ function glossary_get_recent_mod_activity(&$activities, &$index, $timestart, $co
$params['timestart'] = $timestart;
$params['glossaryid'] = $cm->instance;
$ufields = user_picture::fields('u', null, 'userid');
$userfieldsapi = \core\user_fields::for_userpic();
$ufields = $userfieldsapi->get_sql('u', false, '', 'userid', false)->selects;
$entries = $DB->get_records_sql("
SELECT ge.id AS entryid, ge.glossaryid, ge.concept, ge.definition, ge.approved,
ge.timemodified, $ufields
......@@ -564,8 +565,10 @@ function glossary_print_recent_activity($course, $viewfullnames, $timestart) {
if (count($approvals) == 0) {
return false;
}
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', 'userid', false)->selects;
$selectsql = 'SELECT ge.id, ge.concept, ge.approved, ge.timemodified, ge.glossaryid,
'.user_picture::fields('u',null,'userid');
' . $userfields;
$countsql = 'SELECT COUNT(*)';
$joins = array(' FROM {glossary_entries} ge ');
......@@ -3671,7 +3674,8 @@ function glossary_get_authors($glossary, $context, $limit, $from, $options = arr
global $DB, $USER;
$params = array();
$userfields = user_picture::fields('u', null);
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$approvedsql = '(ge.approved <> 0 OR ge.userid = :myid)';
$params['myid'] = $USER->id;
......@@ -3824,7 +3828,8 @@ function glossary_get_entries_by_search($glossary, $context, $query, $fullsearch
list($searchcond, $params) = glossary_get_search_terms_sql($terms, $fullsearch, $glossary->id);
$userfields = user_picture::fields('u', null, 'userdataid', 'userdata');
$userfieldsapi = \core\user_fields::for_userpic();
$userfields = $userfieldsapi->get_sql('u', false, 'userdata', 'userdataid', false)->selects;
// Need one inner view here to avoid distinct + text.
$sqlwrapheader = 'SELECT ge.*, ge.concept AS glossarypivot, ' . $userfields . '
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment