diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php index 8d1f045d..06abc860 100644 --- a/includes/controller/user_angeltypes_controller.php +++ b/includes/controller/user_angeltypes_controller.php @@ -392,7 +392,8 @@ function user_angeltype_add_controller(): array // Load possible users, that are not in the angeltype already $users_source = Users_by_angeltype_inverted($angeltype); - if (request()->hasPostData('submit')) { + $request = request(); + if ($request->hasPostData('submit')) { $user_source = load_user(); if (!UserAngelType_exists($user_source->id, $angeltype)) { @@ -409,12 +410,14 @@ function user_angeltype_add_controller(): array AngelType_name_render($angeltype) )); - UserAngelType_confirm($user_angeltype_id, $user_source->id); - engelsystem_log(sprintf( - 'User %s confirmed as %s.', - User_Nick_render($user_source, true), - AngelType_name_render($angeltype, true) - )); + if ($request->hasPostData('auto_confirm_user')) { + UserAngelType_confirm($user_angeltype_id, $user_source->id); + engelsystem_log(sprintf( + 'User %s confirmed as %s.', + User_Nick_render($user_source, true), + AngelType_name_render($angeltype, true) + )); + } user_angeltype_add_email($user_source, $angeltype); @@ -444,7 +447,8 @@ function user_angeltype_join_controller($angeltype) throw_redirect(page_link_to('angeltypes')); } - if (request()->hasPostData('submit')) { + $request = request(); + if ($request->hasPostData('submit')) { $user_angeltype_id = UserAngelType_create($user->id, $angeltype); $success_message = sprintf(__('You joined %s.'), $angeltype['name']); @@ -455,7 +459,7 @@ function user_angeltype_join_controller($angeltype) )); success($success_message); - if (auth()->can('admin_user_angeltypes')) { + if (auth()->can('admin_user_angeltypes') && $request->hasPostData('auto_confirm_user')) { UserAngelType_confirm($user_angeltype_id, $user->id); engelsystem_log(sprintf( 'User %s confirmed as %s.', diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php index fef46876..cbd498a5 100644 --- a/includes/view/UserAngelTypes_view.php +++ b/includes/view/UserAngelTypes_view.php @@ -150,6 +150,7 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id) ]), form([ form_info(__('Angeltype'), $angeltype['name']), + form_checkbox('auto_confirm_user', __('Confirm user'), true), form_select('user_id', __('User'), $users, $user_id), form_submit('submit', __('Add')) ]) @@ -171,6 +172,7 @@ function UserAngelType_join_view($user, $angeltype) $angeltype['name'] ), true), form([ + auth()->can('admin_user_angeltypes') ? form_checkbox('auto_confirm_user', __('Confirm user'), true) : '', buttons([ button(angeltype_link($angeltype['id']), icon('x-lg') . __('cancel')), form_submit('submit', icon('check-lg') . __('save'), 'btn-primary', false) diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index bc1e6f88..9d1f82ed 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -2420,6 +2420,9 @@ msgstr "Möchtest Du wirklich %s von %s entfernen?" msgid "Do you really want to add %s to %s?" msgstr "Möchtest Du wirklich %s zu %s hinzufügen?" +msgid "Confirm user" +msgstr "Benutzer bestätigen" + #: includes/view/UserAngelTypes_view.php:176 msgid "save" msgstr "Speichern"