wwwroot);
}
if (empty($CFG->messaging)) {
error("Messaging is disabled on this site");
}
/// Script parameters
$userid1 = required_param('user1', PARAM_INT);
if (! $user1 = get_record("user", "id", $userid1)) { // Check it's correct
error("User ID 1 was incorrect");
}
if ($user1->deleted) {
print_header();
print_heading(get_string('userdeleted').': '.$userid1);
print_footer();
die;
}
if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { // Able to see any discussion
$userid2 = optional_param('user2', $USER->id, PARAM_INT);
if (! $user2 = get_record("user", "id", $userid2)) { // Check
error("User ID 2 was incorrect");
}
if ($user2->deleted) {
print_header();
print_heading(get_string('userdeleted').': '.$userid2);
print_footer();
die;
}
} else {
$userid2 = $USER->id; // Can only see messages involving yourself
$user2 = $USER;
}
$search = optional_param('search', '', PARAM_CLEAN);
add_to_log(SITEID, 'message', 'history', 'history.php?user1='.$userid1.'&user2='.$userid2, $userid1);
/// Our two users are defined - let's set up the page
print_header(get_string('messagehistory', 'message'), '', '', '', '
';
echo print_user_picture($user1, SITEID, $user1->picture, 100, true, true, 'userwindow').' '; echo fullname($user1); echo ' | ';
echo ''; echo ''; echo ''; echo ' | '; echo '';
echo print_user_picture($user2, SITEID, $user2->picture, 100, true, true, 'userwindow').' '; echo fullname($user2); echo ' | ';
echo '