1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[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
This commit is contained in:
battye
2018-11-26 13:08:57 +00:00
parent b8bdccbc44
commit 101829b4dc
4 changed files with 43 additions and 4 deletions

View File

@@ -293,7 +293,19 @@ class acp_groups
// Add user/s to group
if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row))
{
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
$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 . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
$message = ($leader) ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED';