1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +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

@@ -1154,6 +1154,7 @@ function database_update_info()
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:255', ''),
'notify' => array('BOOL', 1),
),
'PRIMARY_KEY' => array(
'item_type',
@@ -1164,6 +1165,7 @@ function database_update_info()
'KEYS' => array(
'it' => array('INDEX', 'item_type'),
'uid' => array('INDEX', 'user_id'),
'no' => array('INDEX', 'notify'),
),
),
),
@@ -2755,7 +2757,7 @@ function change_database_data(&$no_updates, $version)
$config->set('site_home_text', '');
}
if (true)//!isset($config['load_notifications']))
if (!isset($config['load_notifications']))
{
$config->set('load_notifications', 1);
@@ -2819,48 +2821,6 @@ function change_database_data(&$no_updates, $version)
$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;