aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-20 19:30:08 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-20 19:30:08 +0000
commit500545ecfe71cb20a0afec0bf37e3f30339c8513 (patch)
tree7b3f4f73a5ce43466fc273aad07a4340e6ddb774 /mod/groups
parent48a06eb1e91cd80f81015a8175f503fcb1a019b5 (diff)
downloadelgg-500545ecfe71cb20a0afec0bf37e3f30339c8513.tar.gz
elgg-500545ecfe71cb20a0afec0bf37e3f30339c8513.tar.bz2
Refs #2787, #2956: Merged fix for deleting group icon files on group delete to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@8368 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/actions/delete.php26
1 files changed, 19 insertions, 7 deletions
diff --git a/mod/groups/actions/delete.php b/mod/groups/actions/delete.php
index a99b3a2c6..6eed12a9c 100644
--- a/mod/groups/actions/delete.php
+++ b/mod/groups/actions/delete.php
@@ -3,18 +3,30 @@
* Delete a group
*/
-$guid = (int)get_input('group_guid');
+$guid = (int) get_input('group_guid');
$entity = get_entity($guid);
-if (($entity) && ($entity instanceof ElggGroup))
-{
- if ($entity->delete())
+if (($entity) && ($entity instanceof ElggGroup)) {
+ // delete group icons
+ $owner_guid = $entity->owner_guid;
+ $prefix = "groups/" . $entity->guid;
+ $imagenames = array('.jpg', 'tiny.jpg', 'small.jpg', 'medium.jpg', 'large.jpg');
+ $img = new ElggFile();
+ $img->owner_guid = $owner_guid;
+ foreach ($imagenames as $name) {
+ $img->setFilename($prefix . $name);
+ $img->delete();
+ }
+
+ // delete group
+ if ($entity->delete()) {
system_message(elgg_echo('group:deleted'));
- else
+ } else {
register_error(elgg_echo('group:notdeleted'));
-}
-else
+ }
+} else {
register_error(elgg_echo('group:notdeleted'));
+}
$url_name = elgg_get_logged_in_user_entity()->username;
forward(elgg_get_site_url() . "pg/groups/member/{$url_name}");