diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-07 16:06:58 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-07 16:06:58 +0000 |
commit | 63712f3acd80878784d4fc1da18d57c18fa88342 (patch) | |
tree | 0cce2ee5188d28e0a7ee5f718fe9ef052b408fd7 /engine/lib/notification.php | |
parent | 86f5e9dfb7b0846808195c2824d7de92e17274a8 (diff) | |
download | elgg-63712f3acd80878784d4fc1da18d57c18fa88342.tar.gz elgg-63712f3acd80878784d4fc1da18d57c18fa88342.tar.bz2 |
Option to hide sender.
git-svn-id: https://code.elgg.org/elgg/trunk@1316 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/notification.php')
-rw-r--r-- | engine/lib/notification.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php index aa4bf35cf..1494c06e7 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -206,9 +206,10 @@ * @param string $subject The subject of the message. * @param string $message The message body * @param array $params Optional parameters (none taken in this instance) + * @param bool $hide_sender If true (default) hide the sender's email address (use noreply@site...) * @return bool */ - function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL) + function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL, $hide_sender = true) { global $CONFIG; @@ -222,16 +223,21 @@ throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid)); $to = $to->email; - if ($from->email) - $from = $from->email; // Handle users - else if ($from->url) + if (!$hide_sender) { - $breakdown = parse_url($from->url); - $from = 'noreply@' . $breakdown['host']; // Handle anything with a url - } - else { - $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback + if ($from->email) + $from = $from->email; // Handle users + else if ($from->url) + { + $breakdown = parse_url($from->url); + $from = 'noreply@' . $breakdown['host']; // Handle anything with a url + } + else { + $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback + } } + else + $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback $headers = "From: $from\r\n"; |