From cca85f648bef5aa97e03f974b143df2f8f28a501 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 4 Jul 2023 08:43:54 +0200 Subject: [PATCH] [ticket/8777] Discourage deleting user with only one group It will still be possible from the manage groups page though is discouraged now by hiding the delete entry when managing users. In addition to this, the manage user page will now show that no group is specified for the user when viewing the groups page of a user. PHPBB3-8777 --- phpBB/adm/style/acp_users.html | 6 +++++- phpBB/includes/acp/acp_users.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 50b6ec9bc9..c500541e63 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -137,9 +137,13 @@ {group.GROUP_NAME} {L_GROUP_DEFAULT}{L_GROUP_DEFAULT}{L_GROUP_APPROVE}  {group.L_DEMOTE_PROMOTE}  - {L_GROUP_DELETE} + {% if group.U_DELETE %}{{ lang('GROUP_DELETE') }}{% endif %} + + + {{ lang('NO_GROUP') }} + diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index c65162eaf2..37e1d79468 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -2515,7 +2515,7 @@ class acp_users 'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), - 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], + 'U_DELETE' => count($id_ary) > 1 ? $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'] : '', 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', 'GROUP_NAME' => $group_helper->get_name($data['group_name']),