diff options
author | Cash Costello <cash.costello@gmail.com> | 2013-03-05 04:07:04 -0800 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2013-03-05 04:07:04 -0800 |
commit | 6b3f37b268426c0961755e9c34c260f5db9c9903 (patch) | |
tree | 4cb20d7b7e02201919b4c3814e02325263a34416 /mod/blog | |
parent | 05dd511d383c0bfb5f20fcbc5436bb25c79d078e (diff) | |
parent | f35cd7f855b60b1c572cd0aee2273a313c85ad53 (diff) | |
download | elgg-6b3f37b268426c0961755e9c34c260f5db9c9903.tar.gz elgg-6b3f37b268426c0961755e9c34c260f5db9c9903.tar.bz2 |
Merge pull request #5131 from cash/blog_notifications
Fixes #4802 notifications sent when status is newly set to published
Diffstat (limited to 'mod/blog')
-rw-r--r-- | mod/blog/actions/blog/save.php | 5 | ||||
-rw-r--r-- | mod/blog/start.php | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 6da70462a..9256610cc 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -158,6 +158,11 @@ if (!$error) { if (($new_post || $old_status == 'draft') && $status == 'published') { add_to_river('river/object/blog/create', 'create', $blog->owner_guid, $blog->getGUID()); + // we only want notifications sent when post published + register_notification_object('object', 'blog', elgg_echo('blog:newpost')); + elgg_trigger_event('publish', 'object', $blog); + + // reset the creation time for posts that move from draft to published if ($guid) { $blog->time_created = time(); $blog->save(); diff --git a/mod/blog/start.php b/mod/blog/start.php index a6ff84355..25cd81935 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -41,8 +41,8 @@ function blog_init() { // override the default url to view a blog object elgg_register_entity_url_handler('object', 'blog', 'blog_url_handler'); - // notifications - register_notification_object('object', 'blog', elgg_echo('blog:newpost')); + // notifications - need to register for unique event because of draft/published status + elgg_register_event_handler('publish', 'object', 'object_notifications'); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message'); // add blog link to |