diff options
author | Nils Adermann <naderman@naderman.de> | 2014-10-25 16:56:26 -0700 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2014-10-25 16:56:26 -0700 |
commit | 33d0872a18e38a694352fcd604649bc65c7da16d (patch) | |
tree | f3e1ba9faffce7c0540e249d5264283b2915ba2b /phpBB/includes | |
parent | 12f7275c8eb636d96ffdd6ab6e7c913a7b567164 (diff) | |
parent | 26d4483d36ec82f6dc8f4943f289be94302ab7ce (diff) | |
download | forums-33d0872a18e38a694352fcd604649bc65c7da16d.tar forums-33d0872a18e38a694352fcd604649bc65c7da16d.tar.gz forums-33d0872a18e38a694352fcd604649bc65c7da16d.tar.bz2 forums-33d0872a18e38a694352fcd604649bc65c7da16d.tar.xz forums-33d0872a18e38a694352fcd604649bc65c7da16d.zip |
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus:
[ticket/13207] Add notification manager mock to user_add method in tests
[ticket/13207] Move default user notifications settings to user_add()
[ticket/13207] Add default subscription options for newly registered users
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_user.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index e4479f07b0..f79a8998c4 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -161,9 +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 * @return the new user's ID. */ -function user_add($user_row, $cp_data = false) +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; @@ -347,6 +348,31 @@ function user_add($user_row, $cp_data = false) 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)) + { + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($notifications_data as $subscription) + { + $phpbb_notifications->add_subscription($subscription['item_type'], 0, $subscription['method'], $user_id); + } + } + /** * Event that returns user id, user detals and user CPF of newly registared user * |