diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 53faa4bc7d..a7b31cfe20 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -494,8 +494,8 @@ class acp_board
'webpush_enable' => ['lang' => 'WEBPUSH_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'webpush_enable', 'explain' => true],
'webpush_vapid_public' => ['lang' => 'WEBPUSH_VAPID_PUBLIC', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true],
'webpush_vapid_private' => ['lang' => 'WEBPUSH_VAPID_PRIVATE', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true],
- 'webpush_method_enables' => ['lang' => 'WEBPUSH_METHOD_ENABLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
- 'webpush_dropdown_subscribe'=> ['lang' => 'WEBPUSH_DROPDOWN_SUBSCRIBE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'webpush_method_default_enable' => ['lang' => 'WEBPUSH_METHOD_DEFAULT_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'webpush_dropdown_subscribe' => ['lang' => 'WEBPUSH_DROPDOWN_SUBSCRIBE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
'legend3' => 'ACP_SUBMIT_CHANGES',
],
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index da22c4739d..355a3342bd 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3874,8 +3874,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
}
// Assign web push template vars globally (if not done already by ucp_notifications) for the dropdown subscribe button
- if ($config['webpush_enable']
- && $config['webpush_dropdown_subscribe']
+ if ($config['webpush_enable'] && $config['webpush_dropdown_subscribe']
&& $template->retrieve_var('NOTIFICATIONS_WEBPUSH_ENABLE') === null)
{
$methods = $phpbb_notifications->get_subscription_methods();
@@ -3883,9 +3882,8 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
if ($webpush)
{
- $formHelper = $phpbb_container->get('form_helper');
- $template_ary = $webpush['method']->get_ucp_template_data($controller_helper, $formHelper);
- $template->assign_vars($template_ary);
+ $form_helper = $phpbb_container->get('form_helper');
+ $template->assign_vars($webpush['method']->get_ucp_template_data($controller_helper, $form_helper));
}
}
}
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 7756586c70..ba8f654a90 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -329,7 +329,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('storage\backup\con
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_enable', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_public', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_vapid_private', '');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_method_enables', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_method_default_enable', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('webpush_dropdown_subscribe', '1');
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 3353a360e8..3228db126b 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -590,10 +590,10 @@ $lang = array_merge($lang, [
'WEBPUSH_VAPID_PUBLIC_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) public key is shared to authenticate push messages from your site.
Caution: Modifying the VAPID public key will automatically render all Web Push subscriptions invalid.',
'WEBPUSH_VAPID_PRIVATE' => 'Server identification private key',
'WEBPUSH_VAPID_PRIVATE_EXPLAIN' => 'The Voluntary Application Server Identification (VAPID) private key is used to generate authenticated push messages dispatched from your site. The VAPID private key must form a valid public-private key pair alongside the VAPID public key.
Caution: Modifying the VAPID private key will automatically render all Web Push subscriptions invalid.',
- 'WEBPUSH_METHOD_ENABLES' => 'Enable all user-based web push notification options by default',
- 'WEBPUSH_METHOD_ENABLES_EXPLAIN'=> 'When this setting is enabled, users who subscribe and allow browser notifications will start receiving them automatically. Users only need to visit the UCP Notification settings to disable any unwanted notifications.
If this setting is disabled, users will not receive any notifications, even if they have subscribed, until they visit the UCP Notification settings to enable the specific notification options they wish to receive.',
+ 'WEBPUSH_METHOD_DEFAULT_ENABLE' => 'Enable all user-based web push notification options by default',
+ 'WEBPUSH_METHOD_DEFAULT_ENABLE_EXPLAIN' => 'When this setting is enabled, users who subscribe and allow browser notifications will start receiving them automatically. Users only need to visit the UCP Notification settings to disable any unwanted notifications.
If this setting is disabled, users will not receive any notifications, even if they have subscribed, until they visit the UCP Notification settings to enable the specific notification options they wish to receive.',
'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Show “Subscribe” button in notification dropdown',
- 'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Display a “Subscribe” button in the Notification dropdown, allowing users to easily subscribe to push notifications from anywhere in the forum.',
+ 'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN' => 'Display a “Subscribe” button in the Notification dropdown, allowing users to easily subscribe to push notifications from anywhere in the forum.',
]);
// Jabber settings
diff --git a/phpBB/phpbb/db/migration/data/v400/add_webpush_options.php b/phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
index 1a1727b256..751ab9e5f4 100644
--- a/phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
+++ b/phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
@@ -26,13 +26,13 @@ class add_webpush_options extends migration
public function effectively_installed(): bool
{
- return $this->config->offsetExists('webpush_method_enables') || $this->config->offsetExists('webpush_dropdown_subscribe');
+ return $this->config->offsetExists('webpush_method_default_enable') || $this->config->offsetExists('webpush_dropdown_subscribe');
}
public function update_data(): array
{
return [
- ['config.add', ['webpush_method_enables', true]],
+ ['config.add', ['webpush_method_default_enable', true]],
['config.add', ['webpush_dropdown_subscribe', true]],
];
}
@@ -40,7 +40,7 @@ class add_webpush_options extends migration
public function revert_data(): array
{
return [
- ['config.remove', ['webpush_method_enables']],
+ ['config.remove', ['webpush_method_default_enable']],
['config.remove', ['webpush_dropdown_subscribe']],
];
}
diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php
index a823aed6a0..902880104d 100644
--- a/phpBB/phpbb/notification/method/webpush.php
+++ b/phpBB/phpbb/notification/method/webpush.php
@@ -96,7 +96,7 @@ class webpush extends messenger_base implements extended_method_interface
*/
public function is_enabled_by_default()
{
- return (bool) $this->config['webpush_method_enables'];
+ return (bool) $this->config['webpush_method_default_enable'];
}
/**
diff --git a/tests/functional/notification_webpush_test.php b/tests/functional/notification_webpush_test.php
index a07e0a8948..61478cec98 100644
--- a/tests/functional/notification_webpush_test.php
+++ b/tests/functional/notification_webpush_test.php
@@ -33,7 +33,7 @@ class phpbb_functional_notification_webpush_test extends phpbb_functional_test_c
'config[webpush_enable]' => 1,
'config[webpush_vapid_public]' => 'BDnYSJHVZBxq834LqDGr893IfazEez7q-jYH2QBNlT0ji2C9UwGosiqz8Dp_ZN23lqAngBZyRjXVWF4ZLA8X2zI',
'config[webpush_vapid_private]' => 'IE5OYlmfWsMbBU1lzvr0bxrxVAXIteSkAnwGlZIhmRk',
- 'config[webpush_method_enables]' => 1,
+ 'config[webpush_method_default_enable]' => 1,
'config[webpush_dropdown_subscribe]' => 1,
];
$form = $crawler->selectButton('submit')->form($form_data);
@@ -74,7 +74,7 @@ class phpbb_functional_notification_webpush_test extends phpbb_functional_test_c
$this->assert_checkbox_is_checked($wp_list, 'notification.type.report_pm_closed_notification.method.webpush');
$this->assert_checkbox_is_checked($wp_list, 'notification.type.report_post_closed_notification.method.webpush');
- $this->set_acp_option('webpush_method_enables', 0);
+ $this->set_acp_option('webpush_method_default_enable', 0);
$crawler = self::request('GET', 'ucp.php?i=ucp_notifications&mode=notification_options');