From 5b3e80ec1722a083d35c20f60ed043951ebd4149 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 8 Jul 2008 12:28:11 +0000 Subject: Introducing notifications on generic comments. git-svn-id: https://code.elgg.org/elgg/trunk@1336 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/comments/add.php | 13 +++++++++++++ engine/lib/notification.php | 2 +- languages/en.php | 23 +++++++++++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/actions/comments/add.php b/actions/comments/add.php index 4f3d5eee8..d89fd7866 100644 --- a/actions/comments/add.php +++ b/actions/comments/add.php @@ -23,6 +23,19 @@ // If posting the comment was successful, say so if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) { + if ($entity->owner_guid != $_SESSION['user']->getGUID()) + notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), + sprintf( + elgg_echo('generic_comment:email:body'), + $entity->title, + $_SESSION['user']->name, + $comment_text, + $entity->getURL(), + $_SESSION['user']->name, + $_SESSION['user']->getURL() + ) + ); + system_message(elgg_echo("generic_comment:posted")); } else { diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 1494c06e7..e711b8bc5 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -241,7 +241,7 @@ $headers = "From: $from\r\n"; - return mail($to, $subject, $message, $headers); + return mail($to, $subject, wordwrap($message), $headers); } /** diff --git a/languages/en.php b/languages/en.php index d4eaf32ef..a9b6fd95d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -502,7 +502,9 @@ Alternatively, you can enter your database settings below and we will try and do 'friend:newfriend:subject' => "%s has made you a friend!", 'friend:newfriend:body' => "%s has made you a friend! -Check them out: %s +To view their profile, click here: + + %s You cannot reply to this email.", @@ -542,7 +544,24 @@ Your password has been reset to: %s", 'generic_comment:blank' => "Sorry; you need to actually put something in your comment before we can save it.", 'generic_comment:notfound' => "Sorry; we could not find the specified item.", 'generic_comment:notdeleted' => "Sorry; we could not delete this comment.", - 'generic_comment:failure' => "An unexpected error occurred when adding your comment. Please try again.", + 'generic_comment:failure' => "An unexpected error occurred when adding your comment. Please try again.", + + 'generic_comment:email:subject' => 'You have a new comment!', + 'generic_comment:email:body' => "You have a new comment on your item \"%s\" from %s. It reads: + + +%s + + +To reply or view the original item, click here: + + %s + +To view %s's profile, click here: + + %s + +You cannot reply to this email.", /** * Languages according to ISO 639-1 -- cgit v1.2.3