From 101829b4dce2874bbe53264c1769bf9699527c2f Mon Sep 17 00:00:00 2001 From: battye Date: Mon, 26 Nov 2018 13:08:57 +0000 Subject: [ticket/15883] Add error for invalid usernames being added to a group Update the ACP and the UCP so that when bulk adding users to a group, if invalid usernames are submitted alongside valid usernames then a message will be displayed to inform the user what the invalid usernames are. PHPBB3-15883 --- phpBB/includes/ucp/ucp_groups.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/ucp') diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 1fb026167a..e32c855179 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -1057,7 +1057,19 @@ class ucp_groups // Add user/s to group if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row)) { - trigger_error($user->lang[$error] . $return_page); + $display_message = $user->lang[$error]; + + if ($error == 'GROUP_USERS_INVALID') + { + // Find which users don't exist + $actual_name_ary = $name_ary; + $actual_user_id_ary = false; + user_get_id_name($actual_user_id_ary, $actual_name_ary, false, true); + + $display_message = sprintf($user->lang['GROUP_USERS_INVALID'], implode($user->lang['COMMA_SEPARATOR'], array_diff($name_ary, $actual_name_ary))); + } + + trigger_error($display_message . $return_page); } trigger_error($user->lang['GROUP_USERS_ADDED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); -- cgit v1.2.1