mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 03:04:09 +02:00
[ticket/11103] Working on default notifications on install/update
PHPBB3-11103
This commit is contained in:
@@ -2755,9 +2755,112 @@ function change_database_data(&$no_updates, $version)
|
||||
$config->set('site_home_text', '');
|
||||
}
|
||||
|
||||
if (!isset($config['load_notifications']))
|
||||
if (true)//!isset($config['load_notifications']))
|
||||
{
|
||||
$config->set('load_notifications', 1);
|
||||
|
||||
// Convert notifications
|
||||
$convert_notifications = array(
|
||||
array(
|
||||
'check' => ($config['allow_topic_notify']),
|
||||
'item_type' => 'phpbb_notification_type_post',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_forum_notify']),
|
||||
'item_type' => 'phpbb_notification_type_topic',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_bookmarks']),
|
||||
'item_type' => 'phpbb_notification_type_bookmark',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_privmsg']),
|
||||
'item_type' => 'phpbb_notification_type_pm',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($convert_notifications as $convert_data)
|
||||
{
|
||||
if ($convert_data['check'])
|
||||
{
|
||||
$sql = 'SELECT user_id, user_notify_type
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_notify = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => '',
|
||||
)), $errored, $error_ary);
|
||||
|
||||
if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH)
|
||||
{
|
||||
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => 'phpbb_notification_method_email',
|
||||
)), $errored, $error_ary);
|
||||
}
|
||||
|
||||
if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH)
|
||||
{
|
||||
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => 'phpbb_notification_method_jabber',
|
||||
)), $errored, $error_ary);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
/*
|
||||
// Add default notifications
|
||||
$default_notifications = array(
|
||||
array(
|
||||
'check' => ($config['allow_topic_notify']),
|
||||
'item_type' => 'phpbb_notification_type_post',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_forum_notify']),
|
||||
'item_type' => 'phpbb_notification_type_topic',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_bookmarks']),
|
||||
'item_type' => 'phpbb_notification_type_bookmark',
|
||||
),
|
||||
array(
|
||||
'check' => ($config['allow_privmsg']),
|
||||
'item_type' => 'phpbb_notification_type_pm',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($default_notifications as $convert_data)
|
||||
{
|
||||
if ($convert_data['check'])
|
||||
{
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id <> ' . ANONYMOUS . '
|
||||
AND user_type <> ' . USER_IGNORE;
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
_sql('INSERT INTO ' . USER_NOTIFICATIONS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
'item_type' => $convert_data['item_type'],
|
||||
'item_id' => 0,
|
||||
'user_id' => $row['user_id'],
|
||||
'method' => '',
|
||||
)), $errored, $error_ary);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
break;
|
||||
|
Reference in New Issue
Block a user