mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/13207] Move default user notifications settings to user_add()
PHPBB3-13207
This commit is contained in:
parent
18f24a2270
commit
81ad381263
2 changed files with 18 additions and 14 deletions
|
@ -161,10 +161,10 @@ function user_update_name($old_name, $new_name)
|
|||
*
|
||||
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
|
||||
* @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array
|
||||
* @param array $notifications_data The notifications settings for the new user
|
||||
* @param array $notifications_data The notifications settings for the new user
|
||||
* @return the new user's ID.
|
||||
*/
|
||||
function user_add($user_row, $cp_data = false, $notifications_data = array())
|
||||
function user_add($user_row, $cp_data = false, $notifications_data = null)
|
||||
{
|
||||
global $db, $user, $auth, $config, $phpbb_root_path, $phpEx;
|
||||
global $phpbb_dispatcher, $phpbb_container;
|
||||
|
@ -348,6 +348,21 @@ function user_add($user_row, $cp_data = false, $notifications_data = array())
|
|||
set_config('newest_user_colour', $row['group_colour'], true);
|
||||
}
|
||||
|
||||
// Use default notifications settings if notifications_data is not set
|
||||
if ($notifications_data === null)
|
||||
{
|
||||
$notifications_data = array(
|
||||
array(
|
||||
'item_type' => 'notification.type.post',
|
||||
'method' => 'notification.method.email',
|
||||
),
|
||||
array(
|
||||
'item_type' => 'notification.type.topic',
|
||||
'method' => 'notification.method.email',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Subscribe user to notifications if necessary
|
||||
if (!empty($notifications_data))
|
||||
{
|
||||
|
|
|
@ -314,24 +314,13 @@ class ucp_register
|
|||
'user_inactive_time' => $user_inactive_time,
|
||||
);
|
||||
|
||||
$user_notifications_data = array(
|
||||
array(
|
||||
'item_type' => 'notification.type.post',
|
||||
'method' => 'notification.method.email',
|
||||
),
|
||||
array(
|
||||
'item_type' => 'notification.type.topic',
|
||||
'method' => 'notification.method.email',
|
||||
),
|
||||
);
|
||||
|
||||
if ($config['new_member_post_limit'])
|
||||
{
|
||||
$user_row['user_new'] = 1;
|
||||
}
|
||||
|
||||
// Register user...
|
||||
$user_id = user_add($user_row, $cp_data, $user_notifications_data);
|
||||
$user_id = user_add($user_row, $cp_data);
|
||||
|
||||
// This should not happen, because the required variables are listed above...
|
||||
if ($user_id === false)
|
||||
|
|
Loading…
Add table
Reference in a new issue