Skip to content

Commit a7907ae

Browse files
committed
New user’s should have their default wpn set too
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 9546447 commit a7907ae

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

event/listener.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static function getSubscribedEvents()
3131
'core.ucp_display_module_before' => 'load_language',
3232
'core.acp_main_notice' => 'compatibility_notice',
3333
'core.page_header_after' => 'load_template_data',
34+
'core.user_add_modify_notifications_data' => 'add_user_notification_data',
3435
];
3536
}
3637

@@ -99,4 +100,24 @@ public function compatibility_notice()
99100
{
100101
$this->template->assign_var('S_WPN_COMPATIBILITY_NOTICE', phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '>='));
101102
}
103+
104+
/**
105+
* Add default web push notification settings for new users
106+
*
107+
* @param \phpbb\event\data $event The event object
108+
* @return void
109+
*/
110+
public function add_user_notification_data($event)
111+
{
112+
$notifications_data = $event['notifications_data'];
113+
$notifications_data[] = [
114+
'item_type' => 'notification.type.quote',
115+
'method' => 'notification.method.phpbb.wpn.webpush',
116+
];
117+
$notifications_data[] = [
118+
'item_type' => 'notification.type.pm',
119+
'method' => 'notification.method.phpbb.wpn.webpush',
120+
];
121+
$event['notifications_data'] = $notifications_data;
122+
}
102123
}

0 commit comments

Comments
 (0)