diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-08-07 17:19:08 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-08-07 17:29:33 +0200 |
commit | e0c2013bb921f04f032744c3bc351c015c759d8d (patch) | |
tree | dc9f79569e572646a0ec49e3e81119802701119e /phpBB/includes/ucp/ucp_groups.php | |
parent | 4f23bb711ca457efba370d7ac67394e0db59b578 (diff) | |
download | forums-e0c2013bb921f04f032744c3bc351c015c759d8d.tar forums-e0c2013bb921f04f032744c3bc351c015c759d8d.tar.gz forums-e0c2013bb921f04f032744c3bc351c015c759d8d.tar.bz2 forums-e0c2013bb921f04f032744c3bc351c015c759d8d.tar.xz forums-e0c2013bb921f04f032744c3bc351c015c759d8d.zip |
[ticket/12822] Add method for deleting avatars and use confirm_box
The method will take care of the actual deletion process in the avatar manager.
Additionally, we'll be using a confirm box while deleting the avatar to prevent
users from accidentally deleting their avatars.
PHPBB3-12822
Diffstat (limited to 'phpBB/includes/ucp/ucp_groups.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_groups.php | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index e4931fbe23..b9606945b4 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -471,6 +471,29 @@ class ucp_groups $avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group'); } + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (confirm_box(true)) + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_'); + $cache->destroy('sql', GROUPS_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + else + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode, + 'g' => $group_id, + 'action' => $action)) + ); + } + } + // Did we submit? if ($update) { @@ -510,19 +533,6 @@ class ucp_groups $submit_ary = array_merge($submit_ary, $result); } } - else - { - if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type'])) - { - $driver->delete($avatar_data); - } - - // Removing the avatar - $submit_ary['avatar_type'] = ''; - $submit_ary['avatar'] = ''; - $submit_ary['avatar_width'] = 0; - $submit_ary['avatar_height'] = 0; - } // Merge any avatars errors into the primary error array $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); |