]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4310 adds missing blog notification function
authorcash <cash.costello@gmail.com>
Sat, 4 Feb 2012 19:26:32 +0000 (14:26 -0500)
committercash <cash.costello@gmail.com>
Sat, 4 Feb 2012 19:26:32 +0000 (14:26 -0500)
mod/blog/languages/en.php
mod/blog/start.php

index 8a21c1f8dfec1a0fdccd20a675527e885faeff57..42606bf8efd6b51e59d79384eca351b426a7e7b5 100644 (file)
@@ -58,6 +58,7 @@ $english = array(
 
        // notifications
        'blog:newpost' => 'A new blog post',
+       'blog:via' => "published a blog post",
 
        // widget
        'blog:widget:description' => 'Display your latest blog posts',
index a8553b4b88423895b650e0886c6675cc01b03f9d..eb4e1108676c953276c0e0dc2eae541c7b373599 100644 (file)
@@ -226,6 +226,34 @@ function blog_entity_menu_setup($hook, $type, $return, $params) {
        return $return;
 }
 
+/**
+ * Set the notification message body
+ * 
+ * @param string $hook    Hook name
+ * @param string $type    Hook type
+ * @param string $message The current message body
+ * @param array  $params  Parameters about the blog posted
+ * @return string
+ */
+function blog_notify_message($hook, $type, $message, $params) {
+       $entity = $params['entity'];
+       $to_entity = $params['to_entity'];
+       $method = $params['method'];
+       if (elgg_instanceof($entity, 'object', 'blog')) {
+               $descr = $entity->description;
+               $title = $entity->title;
+               if ($method == 'email') {
+                       $owner = $entity->getOwnerEntity();
+                       return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+               }
+               if ($method == 'web') {
+                       $owner = $entity->getOwnerEntity();
+                       return $owner->name . ' ' . elgg_echo('blog:via') . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+               }
+       }
+       return null;
+}
+
 /**
  * Register blogs with ECML.
  */