1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 02:36:38 +02:00

[ticket/11103] Set basic notifications to be enabled by default

Now, if there is no row for the user in the user_notifications table,
the user will receive basic notifications. If the user wishes to not
receive notifications, a row must be added with notify = 0.

For other methods besides the basic (e.g. email, jabber) a row must
still be added with notify = 1 for them to receive notifications

PHPBB3-11103
This commit is contained in:
Nathan Guse
2012-10-29 18:09:20 -05:00
parent eddb56f842
commit e549b7663d
26 changed files with 219 additions and 483 deletions

View File

@@ -32,7 +32,7 @@ class ucp_notifications
switch ($mode)
{
case 'notification_options':
$subscriptions = $phpbb_notifications->get_subscriptions(false, true);
$subscriptions = $phpbb_notifications->get_global_subscriptions(false);
// Add/remove subscriptions
if ($request->is_set_post('submit'))
@@ -48,15 +48,6 @@ class ucp_notifications
{
foreach($subscription_types as $type => $data)
{
if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
{
$phpbb_notifications->add_subscription($type);
}
else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type);
}
foreach($notification_methods as $method)
{
if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type])))
@@ -68,6 +59,15 @@ class ucp_notifications
$phpbb_notifications->delete_subscription($type, 0, $method);
}
}
if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
{
$phpbb_notifications->add_subscription($type);
}
else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type);
}
}
}
@@ -78,7 +78,7 @@ class ucp_notifications
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
$this->output_notification_types('notification_types', $phpbb_notifications, $template, $user);
$this->output_notification_types($subscriptions, 'notification_types', $phpbb_notifications, $template, $user);
$this->tpl_name = 'ucp_notifications';
$this->page_title = 'UCP_NOTIFICATION_OPTIONS';
@@ -165,10 +165,9 @@ class ucp_notifications
* @param phpbb_template $template
* @param phpbb_user $user
*/
public function output_notification_types($block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
public function output_notification_types($subscriptions, $block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
$subscriptions = $phpbb_notifications->get_subscriptions(false, true);
foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
{