Make confirmation optional when adding a user to an angeltype
This commit is contained in:
parent
05a206d367
commit
a129f18c2c
|
@ -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)
|
||||
));
|
||||
|
||||
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.',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue