diff --git a/message/index.php b/message/index.php index 42189b9ace4..16c46fbb174 100644 --- a/message/index.php +++ b/message/index.php @@ -178,6 +178,7 @@ if ($currentuser && !empty($user2) && has_capability('moodle/site:sendmessage', $mform = new send_form(); $defaultmessage = new stdClass; $defaultmessage->id = $user2->id; + $defaultmessage->viewing = $viewing; $defaultmessage->message = ''; //Check if the current user has sent a message @@ -322,6 +323,7 @@ echo html_writer::start_tag('div', array('class' => 'messagearea mdl-align')); $mform = new send_form(); $defaultmessage = new stdClass; $defaultmessage->id = $user2->id; + $defaultmessage->viewing = $viewing; $defaultmessage->message = ''; //$defaultmessage->messageformat = FORMAT_MOODLE; $mform->set_data($defaultmessage); diff --git a/message/lib.php b/message/lib.php index b6a848c128f..288db3e177f 100644 --- a/message/lib.php +++ b/message/lib.php @@ -1406,7 +1406,7 @@ function message_contact_link($userid, $linktype='add', $return=false, $script=n * @return string|bool. Returns a string if $return is true. Otherwise returns a boolean. */ function message_history_link($userid1, $userid2, $return=false, $keywords='', $position='', $linktext='') { - global $OUTPUT; + global $OUTPUT, $PAGE; static $strmessagehistory; if (empty($strmessagehistory)) { @@ -1441,6 +1441,9 @@ function message_history_link($userid1, $userid2, $return=false, $keywords='', $ 'resizable' => true); $link = new moodle_url('/message/index.php?history='.MESSAGE_HISTORY_ALL."&user1=$userid1&user2=$userid2$keywords$position"); + if ($PAGE->url && $PAGE->url->get_param('viewing')) { + $link->param('viewing', $PAGE->url->get_param('viewing')); + } $action = null; $str = $OUTPUT->action_link($link, $fulllink, $action, array('title' => $strmessagehistory)); @@ -2091,7 +2094,7 @@ function message_post_message($userfrom, $userto, $message, $format) { * @return void */ function message_print_contactlist_user($contact, $incontactlist = true, $isblocked = false, $selectcontacturl = null, $showactionlinks = true, $selecteduser=null) { - global $OUTPUT, $USER; + global $OUTPUT, $USER, $COURSE; $fullname = fullname($contact); $fullnamelink = $fullname; @@ -2115,7 +2118,7 @@ function message_print_contactlist_user($contact, $incontactlist = true, $isbloc echo html_writer::start_tag('tr'); echo html_writer::start_tag('td', array('class' => 'pix')); - echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => SITEID)); + echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => $COURSE->id)); echo html_writer::end_tag('td'); echo html_writer::start_tag('td', array('class' => 'contact')); diff --git a/message/send_form.php b/message/send_form.php index c08aaa32878..11780dacc75 100644 --- a/message/send_form.php +++ b/message/send_form.php @@ -50,6 +50,8 @@ class send_form extends moodleform { $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); + $mform->addElement('hidden', 'viewing'); + $mform->setType('viewing', PARAM_ALPHANUMEXT); $mform->addElement('textarea', 'message', get_string('message', 'message'), $displayoptions, $editoroptions);