forked from ColdTrick/advanced_notifications
/
start.php
49 lines (41 loc) · 2.65 KB
/
start.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* The main plugin file
*/
require_once(dirname(__FILE__) . "/lib/events.php");
require_once(dirname(__FILE__) . "/lib/functions.php");
require_once(dirname(__FILE__) . "/lib/hooks.php");
// register default Elgg events
elgg_register_event_handler("init", "system", "advanced_notifications_init");
/**
* Gets called during system initialization
*
* @return void
*/
function advanced_notifications_init() {
// default object notifications
elgg_register_event_handler("create", "object", "advanced_notifications_create_object_event_handler");
elgg_register_event_handler("publish", "object", "advanced_notifications_create_object_event_handler"); // for blog as of Elgg 1.8.14
elgg_register_event_handler("notify", "album", "advanced_notifications_create_object_event_handler"); // for TidyPics
elgg_unregister_event_handler("create", "object", "object_notifications");
elgg_unregister_event_handler("publish", "object", "object_notifications"); // for blog as of Elgg 1.8.14
elgg_unregister_event_handler("notify", "album", "object_notifications"); // for TidyPics
// group forum topic notifications
elgg_register_event_handler("create", "annotation", "advanced_notifications_create_annotation_event_handler");
elgg_unregister_event_handler("create", "annotation", "discussion_reply_notifications"); // for Elgg versions >= 1.8.6
elgg_unregister_event_handler("annotate", "all", "group_object_notifications"); // older versions of Elgg < 1.8.6
elgg_register_plugin_hook_handler("notify:annotation:subject", "group_topic_post", "advanced_notifications_discussion_reply_subject_hook");
elgg_register_plugin_hook_handler("notify:entity:subject", "object", "advanced_notifications_discussion_subject_hook");
// replace the email notification body
elgg_register_plugin_hook_handler("notify:entity:message", "object", "advanced_notifications_email_body_hook", 99999);
elgg_register_plugin_hook_handler("notify:annotation:message", "group_topic_post", "advanced_notifications_email_body_hook", 99999);
elgg_register_plugin_hook_handler("action", "comments/add", "advanced_notifications_comment_action_hook");
// unregister some stuff from messages
elgg_unregister_plugin_hook_handler("notify:entity:message", "object", "messages_notification_msg");
advanced_notifications_unregister_notification_object("object", "messages");
// thewire
elgg_unregister_plugin_hook_handler("notify:entity:message", "object", "thewire_notify_message");
// replace site notifications
elgg_register_plugin_hook_handler("register", "menu:filter", "advanced_notifications_filter_menu_hook");
elgg_register_plugin_hook_handler("route", "activity", "advanced_notifications_route_hook");
}