/// get lists of contacts and unread messages
- $onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture
+ $onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom
AND mc.blocked='0'
ORDER BY u.lastaccess DESC");
- $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture
+ $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom
AND mc.blocked='0'
/// link to add to contact list
$strcontact .= message_contact_link($messageuser->useridfrom, 'add', true);
- $strblock .= message_contact_link($messageuser->useridfrom, 'block', true);
+ $strblock = message_contact_link($messageuser->useridfrom, 'block', true);
echo '<tr><td class="message_pic">';
print_user_picture($messageuser->useridfrom, SITEID, $messageuser->picture, 20, false, false);
function message_print_search() {
- global $USER;
+ global $ME, $USER;
if ($frm = data_submitted()) {
function message_print_search_results($frm) {
- global $USER;
+ global $ME, $USER;
echo '<div align="center">';
}
$select = 'u.deleted = \'0\' AND u.confirmed = \'1\'';
+ $fields = 'u.id, u.firstname, u.lastname, u.picture';
if (!$courseid or $courseid == SITEID) {
- return get_records_sql("SELECT u.id, u.firstname, u.lastname
+ return get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u
WHERE $select
AND ($fullname $LIKE '%$searchtext%')
} else {
- if (!$teachers = get_records_sql("SELECT u.id, u.firstname, u.lastname
+ if (!$teachers = get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u,
{$CFG->prefix}user_teachers s
WHERE $select AND s.course = '$courseid' AND s.userid = u.id
$except $order")) {
$teachers = array();
}
- if (!$students = get_records_sql("SELECT u.id, u.firstname, u.lastname
+ if (!$students = get_records_sql("SELECT $fields
FROM {$CFG->prefix}user u,
{$CFG->prefix}user_students s
WHERE $select AND s.course = '$courseid' AND s.userid = u.id
</tr>
<tr>
<td> </td>
- <td colspan="2"><input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td>
+ <td colspan="2">
+ <input type="hidden" name="mycourses" value="0" />
+ <input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td>
</tr>
<tr><td colspan="3"><hr /></td></tr>
<tr>
<td> </td>
- <td colspan="2"><input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td>
+ <td colspan="2">
+ <input type="hidden" name="includeblocked" value="0" />
+ <input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td>
</tr>
<tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlytome', 'message') ?>" value="tome" checked="checked" /><?php print_string('onlytome', 'message') ?></td></tr>