Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-28568_noncontact_warning_22' of git://github.com/an…

…dyjdavis/moodle into MOODLE_22_STABLE
  • Loading branch information...
commit d3fd4849ae74dbb0f488965027c2615d4bb89956 2 parents 20c116f + 9e198bd
Sam Hemelryk authored July 31, 2012
3  lang/en/message.php
@@ -82,6 +82,7 @@
82 82
 $string['messagehistoryfull'] = 'All messages';
83 83
 $string['messages'] = 'Messages';
84 84
 $string['messaging'] = 'Messaging';
  85
+$string['messagingblockednoncontact'] = '{$a} will not be able to reply as you have blocked non-contacts';
85 86
 $string['messagingdisabled'] = 'Messaging is disabled on this site, emails will be sent instead';
86 87
 $string['mycontacts'] = 'My contacts';
87 88
 $string['newonlymsg'] = 'Show only new';
@@ -139,5 +140,5 @@
139 140
 $string['unreadnewnotification'] = 'New notification';
140 141
 $string['unreadnewnotifications'] = 'New notifications ({$a})';
141 142
 $string['userisblockingyou'] = 'This user has blocked you from sending messages to them';
142  
-$string['userisblockingyounoncontact'] = 'This user is only accepting messages from people listed as contacts, and you are not currently on the list.';
  143
+$string['userisblockingyounoncontact'] = '{$a} only accepts messages from their contacts.';
143 144
 $string['userssearchresults'] = 'Users found: {$a}';
15  message/index.php
@@ -154,7 +154,7 @@
154 154
 
155 155
     if (!empty($userpreferences['message_blocknoncontacts'])) {  // User is blocking non-contacts
156 156
         if (empty($contact)) {   // We are not a contact!
157  
-            $messageerror = get_string('userisblockingyounoncontact', 'message');
  157
+            $messageerror = get_string('userisblockingyounoncontact', 'message', fullname($user2));
158 158
         }
159 159
     }
160 160
 
@@ -288,8 +288,19 @@
288 288
         if ($currentuser && has_capability('moodle/site:sendmessage', $context)) {
289 289
             echo html_writer::start_tag('div', array('class' => 'mdl-align messagesend'));
290 290
                 if (!empty($messageerror)) {
291  
-                    echo $OUTPUT->heading($messageerror, 3);
  291
+                    echo html_writer::tag('span', $messageerror, array('id' => 'messagewarning'));
292 292
                 } else {
  293
+                    // Display a warning if the current user is blocking non-contacts and is about to message to a non-contact
  294
+                    // Otherwise they may wonder why they never get a reply
  295
+                    $blocknoncontacts = get_user_preferences('message_blocknoncontacts', '', $user1->id);
  296
+                    if (!empty($blocknoncontacts)) {
  297
+                        $contact = $DB->get_record('message_contacts', array('userid' => $user1->id, 'contactid' => $user2->id));
  298
+                        if (empty($contact)) {
  299
+                            $msg = get_string('messagingblockednoncontact', 'message', fullname($user2));
  300
+                            echo html_writer::tag('span', $msg, array('id' => 'messagewarning'));
  301
+                        }
  302
+                    }
  303
+
293 304
                     $mform = new send_form();
294 305
                     $defaultmessage = new stdClass;
295 306
                     $defaultmessage->id = $user2->id;
1  theme/standard/style/core.css
@@ -451,3 +451,4 @@ table#tag-management-list {margin: 10px auto;width: 80%;}
451 451
 #page-message-edit table.generaltable th.c0 {text-align: left;}
452 452
 #page-message-edit table.generaltable td.c0 {text-align: right;}
453 453
 #page-message-edit table.generaltable td.disallowed {text-align: center;vertical-align:middle;}
  454
+#messagewarning {font-style:italic;}

0 notes on commit d3fd484

Please sign in to comment.
Something went wrong with that request. Please try again.