diff --git a/message/classes/output/messagearea/user_search_results.php b/message/classes/output/messagearea/user_search_results.php index c4fbdad48f2..622c6292f2f 100644 --- a/message/classes/output/messagearea/user_search_results.php +++ b/message/classes/output/messagearea/user_search_results.php @@ -56,9 +56,9 @@ class user_search_results implements templatable, renderable { /** * Constructor. * - * @param array $contacts - * @param array $courses - * @param array $noncontacts + * @param array $contacts list of contacts. + * @param array $courses list of courses. + * @param array $noncontacts list of nonconcat users. */ public function __construct($contacts, $courses = array(), $noncontacts = array()) { $this->contacts = $contacts; @@ -88,7 +88,13 @@ class user_search_results implements templatable, renderable { // Check if there are any courses. if (!empty($this->courses)) { $data->hascourses = true; - $data->courses = $this->courses; + $data->courses = []; + foreach ($this->courses as $course) { + $coursecontext = \context_course::instance($course->id); + $course->shortname = external_format_string($course->shortname, $coursecontext->id, true); + $course->fullname = external_format_string($course->fullname, $coursecontext->id, true); + $data->courses[] = $course; + } } // Check if there are any non-contacts. diff --git a/message/externallib.php b/message/externallib.php index 8ec40addee0..9f3e6e5c1ea 100644 --- a/message/externallib.php +++ b/message/externallib.php @@ -670,8 +670,8 @@ class core_message_external extends external_api { new external_single_structure( array( 'id' => new external_value(PARAM_INT, 'The course id'), - 'shortname' => new external_value(PARAM_NOTAGS, 'The course shortname'), - 'fullname' => new external_value(PARAM_NOTAGS, 'The course fullname'), + 'shortname' => new external_value(PARAM_TEXT, 'The course shortname'), + 'fullname' => new external_value(PARAM_TEXT, 'The course fullname'), ) ) ),