mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +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:
@@ -545,41 +545,57 @@ class phpbb_notification_manager
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subscriptions
|
||||
* Get global subscriptions (item_id = 0)
|
||||
*
|
||||
* @param bool|int $user_id The user_id to add the subscription for (bool false for current user)
|
||||
* @param bool $only_global True to select only global subscription options (item_id = 0)
|
||||
*
|
||||
* @return array Subscriptions
|
||||
*/
|
||||
public function get_subscriptions($user_id = false, $only_global = false)
|
||||
public function get_global_subscriptions($user_id = false)
|
||||
{
|
||||
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
|
||||
|
||||
$subscriptions = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . '
|
||||
WHERE user_id = ' . (int) $user_id .
|
||||
(($only_global) ? ' AND item_id = 0' : '');
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
foreach ($this->get_subscription_types() as $group_name => $types)
|
||||
{
|
||||
if ($only_global)
|
||||
foreach ($types as $id => $type)
|
||||
{
|
||||
if (!isset($subscriptions[$row['item_type']]))
|
||||
$sql = 'SELECT method, notify
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . '
|
||||
WHERE user_id = ' . (int) $user_id . "
|
||||
AND item_type = '" . $this->db->sql_escape($id) . "'
|
||||
AND item_id = 0";
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
if (!$row)
|
||||
{
|
||||
$subscriptions[$row['item_type']] = array();
|
||||
// No rows at all, default to ''
|
||||
$subscriptions[$id] = array('');
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!$row['notify'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($subscriptions[$id]))
|
||||
{
|
||||
$subscriptions[$id] = array();
|
||||
}
|
||||
|
||||
$subscriptions[$id][] = $row['method'];
|
||||
}
|
||||
while ($row = $this->db->sql_fetchrow($result));
|
||||
}
|
||||
|
||||
$subscriptions[$row['item_type']][] = $row['method'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$subscriptions[] = $row;
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $subscriptions;
|
||||
}
|
||||
@@ -594,16 +610,45 @@ class phpbb_notification_manager
|
||||
*/
|
||||
public function add_subscription($item_type, $item_id = 0, $method = '', $user_id = false)
|
||||
{
|
||||
if ($method !== '')
|
||||
{
|
||||
$this->add_subscription($item_type, $item_type, '', $user_id);
|
||||
}
|
||||
|
||||
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
|
||||
|
||||
$sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
|
||||
$this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $item_type,
|
||||
'item_id' => (int) $item_id,
|
||||
'user_id' => (int) $user_id,
|
||||
'method' => $method,
|
||||
));
|
||||
$sql = 'SELECT notify
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||
AND item_id = " . (int) $item_id . '
|
||||
AND user_id = ' .(int) $user_id . "
|
||||
AND method = '" . $this->db->sql_escape($method) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
$current = $this->db->sql_fetchfield('notify');
|
||||
$this->db->sql_freeresult();
|
||||
|
||||
if ($current === false)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
|
||||
$this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $item_type,
|
||||
'item_id' => (int) $item_id,
|
||||
'user_id' => (int) $user_id,
|
||||
'method' => $method,
|
||||
'notify' => 1,
|
||||
));
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
else if (!$current)
|
||||
{
|
||||
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
|
||||
SET notify = 1
|
||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||
AND item_id = " . (int) $item_id . '
|
||||
AND user_id = ' .(int) $user_id . "
|
||||
AND method = '" . $this->db->sql_escape($method) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -618,12 +663,46 @@ class phpbb_notification_manager
|
||||
{
|
||||
$user_id = ($user_id === false) ? $this->user->data['user_id'] : $user_id;
|
||||
|
||||
$sql = 'DELETE FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
// If no method, make sure that no other notification methods for this item are selected before deleting
|
||||
if ($method === '')
|
||||
{
|
||||
$sql = 'SELECT COUNT(*) as count
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||
AND item_id = " . (int) $item_id . '
|
||||
AND user_id = ' .(int) $user_id . "
|
||||
AND method <> ''
|
||||
AND notify = 1";
|
||||
$this->db->sql_query($sql);
|
||||
$count = $this->db->sql_fetchfield('count');
|
||||
$this->db->sql_freeresult();
|
||||
|
||||
if ($count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
|
||||
SET notify = 0
|
||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||
AND item_id = " . (int) $item_id . '
|
||||
AND user_id = ' .(int) $user_id . "
|
||||
AND method = '" . $this->db->sql_escape($method) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
if (!$this->db->sql_affectedrows())
|
||||
{
|
||||
$sql = 'INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' .
|
||||
$this->db->sql_build_array('INSERT', array(
|
||||
'item_type' => $item_type,
|
||||
'item_id' => (int) $item_id,
|
||||
'user_id' => (int) $user_id,
|
||||
'method' => $method,
|
||||
'notify' => 0,
|
||||
));
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -73,30 +73,9 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
|
||||
'item_type' => self::$notification_option['id'],
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -73,30 +73,9 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
|
||||
'item_type' => self::$notification_option['id'],
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -310,26 +310,54 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
/**
|
||||
* Find the users who want to receive notifications (helper)
|
||||
*
|
||||
* @param array $item_id The item_id to search for
|
||||
* @param array $user_ids User IDs to check if they want to receive notifications
|
||||
* (Bool False to check all users besides anonymous and bots (USER_IGNORE))
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _find_users_for_notification($item_id, $options)
|
||||
protected function check_user_notification_options($user_ids = false, $options = array())
|
||||
{
|
||||
$options = array_merge(array(
|
||||
'ignore_users' => array(),
|
||||
'item_type' => get_class($this),
|
||||
'item_id' => 0, // Global by default
|
||||
), $options);
|
||||
|
||||
$rowset = array();
|
||||
if ($user_ids === false)
|
||||
{
|
||||
$user_ids = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND item_id = " . (int) $item_id;
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id <> ' . ANONYMOUS . '
|
||||
AND user_type <> ' . USER_IGNORE;
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$user_ids[] = $row['user_id'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (empty($user_ids))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$rowset = $resulting_user_ids = array();
|
||||
|
||||
$sql = 'SELECT user_id, method, notify
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . "
|
||||
AND item_type = '" . $this->db->sql_escape($options['item_type']) . "'
|
||||
AND item_id = " . (int) $options['item_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
$resulting_user_ids[] = $row['user_id'];
|
||||
|
||||
if (!$row['notify'] || (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -341,8 +369,18 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
|
||||
$rowset[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
foreach ($user_ids as $user_id)
|
||||
{
|
||||
if (!in_array($user_id, $resulting_user_ids) && !isset($options['ignore_users'][$user_id]))
|
||||
{
|
||||
// No rows at all for this user, default to ''
|
||||
$rowset[$user_id] = array('');
|
||||
}
|
||||
}
|
||||
|
||||
return $rowset;
|
||||
}
|
||||
|
||||
|
@@ -87,28 +87,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
$notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
|
||||
|
||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||
$update_notifications = array();
|
||||
|
@@ -80,33 +80,11 @@ class phpbb_notification_type_pm extends phpbb_notification_type_base
|
||||
return array();
|
||||
}
|
||||
|
||||
unset($pm['recipients'][$pm['from_user_id']]);
|
||||
|
||||
$this->notification_manager->load_users(array_keys($pm['recipients']));
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND " . $this->db->sql_in_set('user_id', array_keys($pm['recipients'])) . '
|
||||
AND user_id <> ' . $pm['from_user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options(array_keys($pm['recipients']), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -108,28 +108,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
$notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
|
||||
|
||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||
$update_notifications = array();
|
||||
|
@@ -82,30 +82,9 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
|
||||
|
||||
$auth_approve[$post['forum_id']] = array_unique(array_merge($auth_approve[$post['forum_id']], $auth_approve[0]));
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array(
|
||||
'item_type' => self::$notification_option['id'],
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -106,28 +106,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$post['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
$notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
|
||||
|
||||
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
|
||||
$update_notifications = array();
|
||||
|
@@ -96,31 +96,14 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]) . '
|
||||
AND user_id <> ' . $this->user->data['user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
if (($key = array_search($this->user->data['user_id'], $auth_approve[$post['forum_id']][$this->permission])))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
unset($auth_approve[$post['forum_id']][$this->permission][$key]);
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array(
|
||||
'item_type' => self::$notification_option['id'],
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -82,10 +82,6 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
|
||||
'ignore_users' => array(),
|
||||
), $options);
|
||||
|
||||
// Let's continue to use the phpBB subscriptions system, at least for now.
|
||||
// It may not be the nicest thing, but it is already working and it would be significant work to replace it
|
||||
//$users = parent::_find_users_for_notification($phpbb_container, $topic['forum_id']);
|
||||
|
||||
$users = array();
|
||||
|
||||
$sql = 'SELECT user_id
|
||||
@@ -112,30 +108,7 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
|
||||
return array();
|
||||
}
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . get_class($this) . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_read[$topic['forum_id']]['f_read']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_read[$topic['forum_id']]['f_read'], $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -75,30 +75,9 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top
|
||||
|
||||
$auth_approve[$topic['forum_id']] = array_unique(array_merge($auth_approve[$topic['forum_id']], $auth_approve[0]));
|
||||
|
||||
$notify_users = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_approve[$topic['forum_id']]['m_approve']);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($rowset[$row['user_id']]))
|
||||
{
|
||||
$notify_users[$row['user_id']] = array();
|
||||
}
|
||||
|
||||
$notify_users[$row['user_id']][] = $row['method'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $notify_users;
|
||||
return $this->check_user_notification_options($auth_approve[$topic['forum_id']]['m_approve'], array_merge($options, array(
|
||||
'item_type' => self::$notification_option['id'],
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user