There is a new setting in Messaging, so that you can block any

new messages from people not on your contacts list

I will need this on moodle.org I can tell you!!
This commit is contained in:
moodler 2005-04-23 06:26:10 +00:00
parent 830d0af6d4
commit 3f85157ba7
4 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,7 @@ $string['allusers'] = 'All messages from all users';
$string['backupmessageshelp'] = 'If enabled, then instant messages will be included in SITE automated backups';
$string['beepnewmessage'] = 'Beep when a new message comes in';
$string['blockcontact'] = 'Block contact';
$string['blocknoncontacts'] = 'Block all new messages from people who are not on my contact list';
$string['blockedmessages'] = '$a message(s) to/from blocked users';
$string['context'] = 'context';
$string['contactlistempty'] = 'Your contact list is currently empty';
@ -59,6 +60,7 @@ $string['timesent'] = 'Time Sent';
$string['unblockcontact'] = 'Unblock contact';
$string['unreadmessages'] = '$a unread messages';
$string['userisblockingyou'] = 'This user has blocked you from sending messages to them';
$string['userisblockingyounoncontact'] = 'This user is only accepting messages from people listed as contacts, and you are not currently on the list.';
$string['userssearchresults'] = 'Search results: $a users found';

View File

@ -253,6 +253,7 @@ function message_print_settings() {
$pref = array();
$pref['message_showmessagewindow'] = (isset($frm->showmessagewindow)) ? '1' : '0';
$pref['message_beepnewmessage'] = (isset($frm->beepnewmessage)) ? '1' : '0';
$pref['message_blocknoncontacts'] = (isset($frm->blocknoncontacts)) ? '1' : '0';
$pref['message_usehtmleditor'] = (isset($frm->usehtmleditor)) ? '1' : '0';
$pref['message_emailmessages'] = (isset($frm->emailmessages)) ? '1' : '0';
$pref['message_emailtimenosee'] = ((int)$frm->emailtimenosee > 0) ? (int)$frm->emailtimenosee : '10';
@ -266,6 +267,7 @@ function message_print_settings() {
$cbshowmessagewindow = (get_user_preferences('message_showmessagewindow', 1) == '1') ? 'checked="checked"' : '';
$cbbeepnewmessage = (get_user_preferences('message_beepnewmessage', 0) == '1') ? 'checked="checked"' : '';
$cbblocknoncontacts = (get_user_preferences('message_blocknoncontacts', 0) == '1') ? 'checked="checked"' : '';
$cbusehtmleditor = (get_user_preferences('message_usehtmleditor', 0) == '1') ? 'checked="checked"' : '';
$cbemailmessages = (get_user_preferences('message_emailmessages', 1) == '1') ? 'checked="checked"' : '';
$txemailaddress = get_user_preferences('message_emailaddress', $USER->email);

View File

@ -39,6 +39,12 @@
exit;
}
}
if (get_user_preferences('message_blocknoncontacts', 0, $user->id)) { // User is blocking non-contacts
if (empty($contact)) { // We are not a contact!
print_heading(get_string('userisblockingyounoncontact', 'message'));
exit;
}
}
if ($message and confirm_sesskey()) { /// Current user has just sent a message

View File

@ -8,6 +8,10 @@
<td align="right"><input type="checkbox" name="showmessagewindow" alt="<?php print_string('showmessagewindow', 'message') ?>" <?php echo $cbshowmessagewindow ?> /></td>
<td colspan="2"><?php print_string('showmessagewindow', 'message') ?></td>
</tr>
<tr valign="top">
<td align="right"><input type="checkbox" name="blocknoncontacts" alt="<?php print_string('blocknoncontacts', 'message') ?>" <?php echo $cbblocknoncontacts ?> /></td>
<td colspan="2"><?php print_string('blocknoncontacts', 'message') ?></td>
</tr>
<tr valign="top">
<td align="right"><input type="checkbox" name="beepnewmessage" alt="<?php print_string('beepnewmessage', 'message') ?>" <?php echo $cbbeepnewmessage ?> /></td>
<td colspan="2"><?php print_string('beepnewmessage', 'message') ?></td>