fixed moodle/site:readallmessages MDL-7160 ; commented out unfinished buggy code; merged from MOODLE_17_STABLE

This commit is contained in:
skodak
2006-10-22 19:20:02 +00:00
parent 116cd201ea
commit 1ac417517e
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
error("User ID 1 was incorrect");
}
if (has_capability('moodle/site:readmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // Able to see any discussion
if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { // 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");
+3 -1
View File
@@ -232,6 +232,8 @@ function message_print_search() {
message_print_search_results($frm);
} else {
/*
/// unfinished buggy code disabled in search.html anyway
// find all courses this use has readallmessages capabilities in
if ($teachers = get_user_capability_course('moodle/site:readallmessages')) {
$courses = get_courses('all', 'c.sortorder ASC', 'c.id, c.shortname');
@@ -241,7 +243,7 @@ function message_print_search() {
}
$cs .= '</select>';
}
*/
include('search.html');
}
}
+1 -1
View File
@@ -43,7 +43,7 @@
<tr><td>&nbsp;</td><td colspan="2"><input type="radio" name="keywordsoption" alt="<?php print_string('onlyfromme', 'message') ?>" value="fromme" /><?php print_string('onlyfromme', 'message') ?></td></tr>
<tr><td>&nbsp;</td><td colspan="2"><input type="radio" checked="checked" name="keywordsoption" alt="<?php print_string('allmine', 'message') ?>" value="allmine" /><?php print_string('allmine', 'message') ?></td></tr>
<?php if (has_capability('moodle/site:readmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { ?>
<?php if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) { ?>
<tr><td>&nbsp;</td><td colspan="2"><input type="radio" name="keywordsoption" alt="<?php print_string('allusers', 'message') ?>" value="allusers" /><?php print_string('allusers', 'message') ?></td></tr>
<?php } ?>
+1 -1
View File
@@ -47,7 +47,7 @@
/// Check that the user is not blocking us!!
if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
if ($contact->blocked and !has_capability('moodle/site:readmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
print_heading(get_string('userisblockingyou', 'message'));
exit;
}