[ticket/11744] Move notification from ucp_groups to group_user_add

PHPBB3-11744
This commit is contained in:
Nathaniel Guse 2013-07-26 11:22:44 -05:00
parent e0ef10128b
commit c260e82a9b
2 changed files with 15 additions and 8 deletions

View file

@ -2534,7 +2534,7 @@ function group_delete($group_id, $group_name = false)
*/
function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false)
{
global $db, $auth;
global $db, $auth, $phpbb_container;
// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);
@ -2622,6 +2622,20 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
group_update_listings($group_id);
if ($pending)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
foreach ($add_id_ary as $user_id)
{
$phpbb_notifications->add_notifications('group_request', array(
'group_id' => $group_id,
'user_id' => $user_id,
'group_name' => $group_name,
));
}
}
// Return false - no error
return false;
}

View file

@ -197,13 +197,6 @@ class ucp_groups
else
{
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->add_notifications('group_request', array_merge(
$group_row[$group_id],
array('user_id' => $user->data['user_id'])
));
}
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']);