Skip to content
Browse files

MDL-20627 user - Fixed viewing permission of email when sending group…

… messages.
  • Loading branch information...
1 parent cf04ce3 commit 97aef9b3ad08eeedc5bb4cd03bae4d004db6a854 @abgreeve abgreeve committed Nov 15, 2011
Showing with 9 additions and 2 deletions.
  1. +1 −0 lang/en/moodle.php
  2. +7 −1 user/message.html
  3. +1 −1 user/messageselect.php
View
1 lang/en/moodle.php
@@ -530,6 +530,7 @@
$string['emaildisableclick'] = 'Click here to disable all email from being sent to this address';
$string['emaildisplay'] = 'Email display';
$string['emaildisplaycourse'] = 'Allow only other course members to see my email address';
+$string['emaildisplayhidden'] = 'Email hidden';
$string['emaildisplayno'] = 'Hide my email address from everyone';
$string['emaildisplayyes'] = 'Allow everyone to see my email address';
$string['emailenable'] = 'This email address is enabled';
View
8 user/message.html
@@ -34,7 +34,13 @@
<?php
if (count($SESSION->emailto[$id])) {
foreach ($SESSION->emailto[$id] as $user) {
- echo '<tr><td>'.fullname($user,true).'</td><td>'.$user->email.'</td><td>';
+ echo '<tr><td>'.fullname($user,true).'</td>';
+ // Check to see if we should be showing the email address.
+ if ($user->maildisplay == 0) { // 0 = don't display my email to anyone.
+ echo '<td>'. get_string('emaildisplayhidden') .'</td><td>';
+ } else {
+ echo '<td>'.$user->email.'</td><td>';
+ }
if (empty($user->email)) {
$error = get_string('emailempty');
}
View
2 user/messageselect.php
@@ -95,7 +95,7 @@
foreach ($data as $k => $v) {
if (preg_match('/^(user|teacher)(\d+)$/',$k,$m)) {
if (!array_key_exists($m[2],$SESSION->emailto[$id])) {
- if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id,firstname,lastname,idnumber,email,mailformat,lastaccess, lang')) {
+ if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id,firstname,lastname,idnumber,email,mailformat,lastaccess, lang, maildisplay')) {
$SESSION->emailto[$id][$m[2]] = $user;
$count++;
}

0 comments on commit 97aef9b

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