diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 16fdae6dd0..fc9b48c624 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -495,17 +495,24 @@ class phpbb_notification_manager if ($class->is_available() && method_exists($class_name, 'get_item_type')) { - if ($class_name::$notification_option === false) - { - $subscription_types[$class_name::get_item_type()] = $class_name::get_item_type(); - } - else - { - $subscription_types[$class_name::$notification_option['id']] = $class_name::$notification_option; - } + $options = array_merge(array( + 'id' => $class_name::get_item_type(), + 'lang' => 'NOTIFICATION_TYPE_' . strtoupper($class_name::get_item_type()), + 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', + ), (($class_name::$notification_option !== false) ? $class_name::$notification_option : array())); + + $subscription_types[$options['group']][$options['id']] = $options; } } + // Move Miscellaneous to the very last section + if (isset($subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'])) + { + $miscellaneous = $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']; + unset($subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']); + $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS'] = $miscellaneous; + } + return $subscription_types; } diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/includes/notification/type/approve_post.php index 68e8352a13..6ed9b6c67c 100644 --- a/phpBB/includes/notification/type/approve_post.php +++ b/phpBB/includes/notification/type/approve_post.php @@ -41,11 +41,12 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', ); /** diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/includes/notification/type/approve_topic.php index f3a94e44b8..1ff5ae43bd 100644 --- a/phpBB/includes/notification/type/approve_topic.php +++ b/phpBB/includes/notification/type/approve_topic.php @@ -41,11 +41,12 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', ); /** diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index 3aac8a7dd3..e8959d1352 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -34,7 +34,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * Notification option data (for outputting to the user) * * @var bool|array False if the service should use its default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = false; diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/includes/notification/type/disapprove_post.php index 1bf9242c52..8044a3e0ea 100644 --- a/phpBB/includes/notification/type/disapprove_post.php +++ b/phpBB/includes/notification/type/disapprove_post.php @@ -41,11 +41,12 @@ class phpbb_notification_type_disapprove_post extends phpbb_notification_type_ap * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', ); /** diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/includes/notification/type/disapprove_topic.php index f3e0be4883..04fec87014 100644 --- a/phpBB/includes/notification/type/disapprove_topic.php +++ b/phpBB/includes/notification/type/disapprove_topic.php @@ -41,11 +41,12 @@ class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_a * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'moderation_queue', 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', ); /** diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index a4792cd7f2..ee26a8c33e 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -37,6 +37,16 @@ class phpbb_notification_type_post extends phpbb_notification_type_base */ protected $language_key = 'NOTIFICATION_POST'; + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + public static $notification_option = array( + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + /** * Get the type of notification this is * phpbb_notification_type_ diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php index 4f92eb157a..499fd1e8ed 100644 --- a/phpBB/includes/notification/type/post_in_queue.php +++ b/phpBB/includes/notification/type/post_in_queue.php @@ -41,11 +41,12 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'needs_approval', 'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_MODERATION', ); /** diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/includes/notification/type/report_pm.php index 3619c5510c..440092afdc 100644 --- a/phpBB/includes/notification/type/report_pm.php +++ b/phpBB/includes/notification/type/report_pm.php @@ -48,11 +48,12 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'report', 'lang' => 'NOTIFICATION_TYPE_REPORT', + 'group' => 'NOTIFICATION_GROUP_MODERATION', ); /** diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/includes/notification/type/report_post.php index d7a0d58167..d860fb1b38 100644 --- a/phpBB/includes/notification/type/report_post.php +++ b/phpBB/includes/notification/type/report_post.php @@ -53,6 +53,7 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i public static $notification_option = array( 'id' => 'report', 'lang' => 'NOTIFICATION_TYPE_REPORT', + 'group' => 'NOTIFICATION_GROUP_MODERATION', ); /** diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php index cb38b0274e..237f430003 100644 --- a/phpBB/includes/notification/type/topic.php +++ b/phpBB/includes/notification/type/topic.php @@ -37,6 +37,16 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base */ protected $language_key = 'NOTIFICATION_TOPIC'; + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + public static $notification_option = array( + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + /** * Get the type of notification this is * phpbb_notification_type_ diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/includes/notification/type/topic_in_queue.php index 96f09cef9e..eb14c098e1 100644 --- a/phpBB/includes/notification/type/topic_in_queue.php +++ b/phpBB/includes/notification/type/topic_in_queue.php @@ -41,11 +41,12 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top * Notification option data (for outputting to the user) * * @var bool|array False if the service should use it's default data - * Array of data (including keys 'id' and 'lang') + * Array of data (including keys 'id', 'lang', and 'group') */ public static $notification_option = array( 'id' => 'needs_approval', 'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_MODERATION', ); /** diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 35783e1b56..98165a7bf7 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -44,30 +44,33 @@ class ucp_notifications $notification_methods = $phpbb_notifications->get_subscription_methods(); - foreach($phpbb_notifications->get_subscription_types() as $type => $data) + foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { - if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type])) + foreach($subscription_types as $type => $data) { - // add - $phpbb_notifications->add_subscription($type); - } - else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type])) - { - // remove - $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]))) + if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type])) { // add - $phpbb_notifications->add_subscription($type, 0, $method); + $phpbb_notifications->add_subscription($type); } - else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) + else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type])) { // remove - $phpbb_notifications->delete_subscription($type, 0, $method); + $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]))) + { + // add + $phpbb_notifications->add_subscription($type, 0, $method); + } + else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) + { + // remove + $phpbb_notifications->delete_subscription($type, 0, $method); + } } } } @@ -172,25 +175,33 @@ class ucp_notifications $notification_methods = $phpbb_notifications->get_subscription_methods(); $subscriptions = $phpbb_notifications->get_subscriptions(false, true); - foreach($phpbb_notifications->get_subscription_types() as $type => $data) + foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { $template->assign_block_vars($block, array( - 'TYPE' => $type, - - 'NAME' => (is_array($data) && isset($data['lang'])) ? $user->lang($data['lang']) : $user->lang('NOTIFICATION_TYPE_' . strtoupper($type)), - - 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false, + 'GROUP_NAME' => $user->lang($group), )); - foreach($notification_methods as $method) + foreach($subscription_types as $type => $data) { - $template->assign_block_vars($block . '.notification_methods', array( - 'METHOD' => $method, + $template->assign_block_vars($block, array( + 'TYPE' => $type, - 'NAME' => $user->lang('NOTIFICATION_METHOD_' . strtoupper($method)), + 'NAME' => $user->lang($data['lang']), + 'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '', - 'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) ? true : false, + 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false, )); + + foreach($notification_methods as $method) + { + $template->assign_block_vars($block . '.notification_methods', array( + 'METHOD' => $method, + + 'NAME' => $user->lang('NOTIFICATION_METHOD_' . strtoupper($method)), + + 'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) ? true : false, + )); + } } } } diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index d75609880b..1d17ed5caf 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -292,6 +292,9 @@ $lang = array_merge($lang, array( 'NOTIFICATIONS_MARK_ALL_READ' => 'Mark all notifications read', 'NOTIFICATIONS_MARK_ALL_READ_CONFIRM' => 'Are you sure you want to mark all notifications read?', 'NOTIFICATIONS_MARK_ALL_READ_SUCCESS' => 'All notifications have been marked read successfully.', + 'NOTIFICATION_GROUP_MISCELLANEOUS' => 'Miscellaneous Notifications', + 'NOTIFICATION_GROUP_MODERATION' => 'Moderation Notifications', + 'NOTIFICATION_GROUP_POSTING' => 'Posting Notifications', 'NOTIFICATION_METHOD_EMAIL' => 'Email', 'NOTIFICATION_METHOD_JABBER' => 'Jabber', 'NOTIFICATION_TYPE' => 'Notification type', diff --git a/phpBB/styles/prosilver/template/ucp_notifications.html b/phpBB/styles/prosilver/template/ucp_notifications.html index 3ee58a278e..94e8432508 100644 --- a/phpBB/styles/prosilver/template/ucp_notifications.html +++ b/phpBB/styles/prosilver/template/ucp_notifications.html @@ -23,17 +23,28 @@