phpBB

Code Changes

File: phpbb/notification/manager.php

  Unmodified   Added   Modified   Removed
Line 254Line 254
		$options = array_merge(array(
'ignore_users' => array(),
), $options);

		$options = array_merge(array(
'ignore_users' => array(),
), $options);

 

$notified_users = [];
$add_notifications_override = false;

/**
* Get notification data before find_users_for_notification() execute
*
* @event core.notification_manager_add_notifications_before
* @var bool add_notifications_override Flag indicating whether function should return after event
* @var array|string notification_type_name Type identifier or array of item types
* @var string data Data specific for this notification type that will be inserted
* @var array notified_users Array of notified users
* @var string options Optional options to control what notifications are loaded
* @since 3.3.6-RC1
*/
$vars = [
'add_notifications_override',
'notification_type_name',
'data',
'notified_users',
'options',
];
extract($this->phpbb_dispatcher->trigger_event('core.notification_manager_add_notifications_before', compact($vars)));

if ($add_notifications_override)
{
return $notified_users;
}


if (is_array($notification_type_name))
{


if (is_array($notification_type_name))
{

			$notified_users = array();

 
			$temp_options = $options;

foreach ($notification_type_name as $type)

			$temp_options = $options;

foreach ($notification_type_name as $type)

Line 277Line 304
		* Here, $notify_users is already filtered by f_read and the ignored list included in the options variable
*
* @event core.notification_manager_add_notifications

		* Here, $notify_users is already filtered by f_read and the ignored list included in the options variable
*
* @event core.notification_manager_add_notifications

		* @var	string	notification_type_name		The forum id from where the topic belongs

		* @var	string	notification_type_name		The notification type identifier

		* @var	array 	data						Data specific for the notification_type_name used will be inserted
* @var array notify_users The array of userid that are going to be notified for this notification. Set to array() to cancel.
* @var array options The options that were used when this method was called (read only)

		* @var	array 	data						Data specific for the notification_type_name used will be inserted
* @var array notify_users The array of userid that are going to be notified for this notification. Set to array() to cancel.
* @var array options The options that were used when this method was called (read only)

Line 333Line 360
		foreach ($this->get_subscription_methods_instances() as $method)
{
$notified_users = $method->get_notified_users($notification_type_id, array('item_id' => $item_id));

		foreach ($this->get_subscription_methods_instances() as $method)
{
$notified_users = $method->get_notified_users($notification_type_id, array('item_id' => $item_id));

 


			foreach ($notified_users as $user => $notifications)
{
unset($notify_users[$user]);
}
}

			foreach ($notified_users as $user => $notifications)
{
unset($notify_users[$user]);
}
}

 

/**
* Allow filtering the $notify_users array by $notification_type_name for a notification that is about to be sent.
* Here, $notify_users is already filtered from users who've already been notified.
*
* @event core.notification_manager_add_notifications_for_users_modify_data
* @var string notification_type_name The notification type identifier
* @var array data Data specific for this type that will be inserted
* @var array notify_users User list to notify
*
* @since 3.2.10-RC1
* @since 3.3.1-RC1
*/
$vars = [
'notification_type_name',
'data',
'notify_users',
];
extract($this->phpbb_dispatcher->trigger_event('core.notification_manager_add_notifications_for_users_modify_data', compact($vars)));


if (!count($notify_users))
{


if (!count($notify_users))
{

Line 364Line 411

foreach ($methods as $method)
{


foreach ($methods as $method)
{

				// setup the notification methods and add the notification to the queue







				// Do not load non-existent notification methods
if (!isset($this->notification_methods[$method]))
{
continue;
}

// Setup the notification methods and add the notification to the queue

				if (!isset($notification_methods[$method]))
{
$notification_methods[$method] = $this->get_method_class($method);
}

				if (!isset($notification_methods[$method]))
{
$notification_methods[$method] = $this->get_method_class($method);
}



 
				$notification_methods[$method]->add_to_queue($notification);
}
}

				$notification_methods[$method]->add_to_queue($notification);
}
}