/** * Initialize the plugin * * @return void */ function notifier_init() { notifier_set_view_listener(); // Add hidden popup module to topbar elgg_extend_view('page/elements/topbar', 'notifier/popup'); elgg_require_js('notifier/notifier'); elgg_register_page_handler('notifier', 'notifier_page_handler'); // Add css elgg_extend_view('elgg.css', 'notifier/notifier.css'); elgg_register_notification_method('notifier'); elgg_register_plugin_hook_handler('send', 'notification:notifier', 'notifier_notification_send'); elgg_register_plugin_hook_handler('route', 'friendsof', 'notifier_read_friends_notification'); elgg_register_event_handler('create', 'relationship', 'notifier_relationship_notifications'); elgg_register_event_handler('delete', 'relationship', 'notifier_read_group_invitation_notification'); // Hook handler for cron that removes old messages elgg_register_plugin_hook_handler('cron', 'daily', 'notifier_cron'); elgg_register_plugin_hook_handler('register', 'menu:topbar', 'notifier_topbar_menu_setup'); elgg_register_event_handler('create', 'user', 'notifier_enable_for_new_user'); elgg_register_event_handler('join', 'group', 'notifier_enable_for_new_group_member'); $action_path = elgg_get_plugins_path() . 'notifier/actions/notifier/'; elgg_register_action('notifier/dismiss', $action_path . 'dismiss.php'); elgg_register_action('notifier/dismiss_one', $action_path . 'dismiss_one.php'); elgg_register_action('notifier/clear', $action_path . 'clear.php'); elgg_register_action('notifier/delete', $action_path . 'delete.php'); }
function site_notifications_init() { // register as a notification type elgg_register_notification_method('site'); elgg_register_plugin_hook_handler('send', 'notification:site', 'site_notifications_send'); elgg_register_page_handler('site_notifications', 'site_notifications_page_handler'); elgg_extend_view('elgg.css', 'site_notifications/css'); $js = elgg_get_simplecache_url('site_notifications.js'); elgg_register_js('elgg.site_notifications', $js, 'footer'); site_notifications_set_topbar(); }
public function setUp() { elgg_register_notification_method('test'); $this->user1 = new ElggUser(); $this->user1->username = '******'; $this->user1->save(); $this->user2 = new ElggUser(); $this->user2->username = '******'; $this->user2->save(); $this->group = new ElggGroup(); $this->group->save(); }
function site_notifications_init() { // register as a notification type elgg_register_notification_method('site'); elgg_register_plugin_hook_handler('send', 'notification:site', 'site_notifications_send'); elgg_register_page_handler('site_notifications', 'site_notifications_page_handler'); elgg_extend_view('css/elgg', 'site_notifications/css'); $js = elgg_get_simplecache_url('js', 'site_notifications'); elgg_register_js('elgg.site_notifications', $js, 'footer'); site_notifications_set_topbar(); $actions_base = elgg_get_plugins_path() . 'site_notifications/actions/site_notifications'; elgg_register_action('site_notifications/delete', "{$actions_base}/delete.php"); }
/** * This function registers a handler for a given notification type (eg "email") * * @param string $method The method * @param string $handler The handler function, in the format * "handler(\ElggEntity $from, \ElggUser $to, $subject, * $message, array $params = NULL)". This function should * return false on failure, and true/a tracking message ID on success. * @param array $params An associated array of other parameters for this handler * defining some properties eg. supported msg length or rich text support. * * @return bool * @deprecated 1.9 Use elgg_register_notification_method() */ function register_notification_handler($method, $handler, $params = NULL) { elgg_deprecated_notice(__FUNCTION__ . ' is deprecated by elgg_register_notification_method()', 1.9); elgg_register_notification_method($method); _elgg_services()->notifications->registerDeprecatedHandler($method, $handler); }
/** * @access private */ function _elgg_notifications_init() { elgg_register_plugin_hook_handler('cron', 'minute', '_elgg_notifications_cron', 100); elgg_register_event_handler('all', 'all', '_elgg_enqueue_notification_event', 700); // add email notifications elgg_register_notification_method('email'); elgg_register_plugin_hook_handler('send', 'notification:email', '_elgg_send_email_notification'); elgg_register_plugin_hook_handler('email', 'system', '_elgg_notifications_smtp_default_message_id_header', 1); elgg_register_plugin_hook_handler('email', 'system', '_elgg_notifications_smtp_thread_headers'); // add ability to set personal notification method elgg_extend_view('forms/account/settings', 'core/settings/account/notifications'); elgg_register_plugin_hook_handler('usersettings:save', 'user', '_elgg_save_notification_user_settings'); }
public function testElggUserNotificationSettings() { elgg_register_notification_method('method1'); elgg_register_notification_method('method2'); $this->user->setNotificationSetting('method1', true); $this->user->setNotificationSetting('method2', false); $this->user->setNotificationSetting('method3', true); $settings = $this->user->getNotificationSettings(); $this->assertTrue($settings['method1']); $this->assertFalse($settings['method2']); $this->assertTrue(!isset($settings['method3'])); $this->user->delete(); }