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:
@@ -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;
|
||||
|
@@ -1240,13 +1240,15 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_type VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||
item_id INTEGER DEFAULT 0 NOT NULL,
|
||||
user_id INTEGER DEFAULT 0 NOT NULL,
|
||||
method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL
|
||||
method VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||
notify INTEGER DEFAULT 1 NOT NULL
|
||||
);;
|
||||
|
||||
ALTER TABLE phpbb_user_notifications ADD PRIMARY KEY (item_type, item_id, user_id, method);;
|
||||
|
||||
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications(item_type);;
|
||||
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications(user_id);;
|
||||
CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications(notify);;
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
|
@@ -1526,7 +1526,8 @@ CREATE TABLE [phpbb_user_notifications] (
|
||||
[item_type] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||
[item_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[user_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[method] [varchar] (255) DEFAULT ('') NOT NULL
|
||||
[method] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||
[notify] [int] DEFAULT (1) NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
@@ -1546,6 +1547,9 @@ GO
|
||||
CREATE INDEX [uid] ON [phpbb_user_notifications]([user_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [no] ON [phpbb_user_notifications]([notify]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
|
@@ -877,9 +877,11 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
method varbinary(255) DEFAULT '' NOT NULL,
|
||||
notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||
PRIMARY KEY (item_type, item_id, user_id, method),
|
||||
KEY it (item_type),
|
||||
KEY uid (user_id)
|
||||
KEY uid (user_id),
|
||||
KEY no (notify)
|
||||
);
|
||||
|
||||
|
||||
|
@@ -877,9 +877,11 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
method varchar(255) DEFAULT '' NOT NULL,
|
||||
notify tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||
PRIMARY KEY (item_type, item_id, user_id, method),
|
||||
KEY it (item_type),
|
||||
KEY uid (user_id)
|
||||
KEY uid (user_id),
|
||||
KEY no (notify)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
@@ -1645,6 +1645,7 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_id number(8) DEFAULT '0' NOT NULL,
|
||||
user_id number(8) DEFAULT '0' NOT NULL,
|
||||
method varchar2(255) DEFAULT '' ,
|
||||
notify number(1) DEFAULT '1' NOT NULL,
|
||||
CONSTRAINT pk_phpbb_user_notifications PRIMARY KEY (item_type, item_id, user_id, method)
|
||||
)
|
||||
/
|
||||
@@ -1653,6 +1654,8 @@ CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type)
|
||||
/
|
||||
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id)
|
||||
/
|
||||
CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify)
|
||||
/
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
|
@@ -1127,11 +1127,13 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_id INT4 DEFAULT '0' NOT NULL CHECK (item_id >= 0),
|
||||
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
||||
method varchar(255) DEFAULT '' NOT NULL,
|
||||
notify INT2 DEFAULT '1' NOT NULL CHECK (notify >= 0),
|
||||
PRIMARY KEY (item_type, item_id, user_id, method)
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
|
||||
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
|
||||
CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_user_group'
|
||||
|
@@ -771,13 +771,8 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
|
||||
|
||||
# User Notification Options (for first user)
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('report', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('needs_approval', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_bookmark', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_pm', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_post', 0, 2, 'phpbb_notification_method_email');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_quote', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('phpbb_notification_type_topic', 0, 2, 'phpbb_notification_method_email');
|
||||
|
||||
|
@@ -850,11 +850,13 @@ CREATE TABLE phpbb_user_notifications (
|
||||
item_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
method varchar(255) NOT NULL DEFAULT '',
|
||||
notify INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (item_type, item_id, user_id, method)
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_user_notifications_it ON phpbb_user_notifications (item_type);
|
||||
CREATE INDEX phpbb_user_notifications_uid ON phpbb_user_notifications (user_id);
|
||||
CREATE INDEX phpbb_user_notifications_no ON phpbb_user_notifications (notify);
|
||||
|
||||
# Table: 'phpbb_user_group'
|
||||
CREATE TABLE phpbb_user_group (
|
||||
|
Reference in New Issue
Block a user