aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/actions
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 19:16:23 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 19:16:23 +0000
commitc2d82db47ccdbd388658433d1f703c560d7fb84b (patch)
tree0bb352e9f7f9b6f676a5a7b608c18b2fe363b39b /mod/pages/actions
parent562900f1b36820843a28d7b68f2f0f3e55e04dbf (diff)
downloadelgg-c2d82db47ccdbd388658433d1f703c560d7fb84b.tar.gz
elgg-c2d82db47ccdbd388658433d1f703c560d7fb84b.tar.bz2
Fixes #2853 pages plugin uses the icon url plugin hook and fixes delete action
git-svn-id: http://code.elgg.org/elgg/trunk@8044 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages/actions')
-rw-r--r--mod/pages/actions/pages/delete.php41
1 files changed, 22 insertions, 19 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php
index 8bc20b821..aea383ef8 100644
--- a/mod/pages/actions/pages/delete.php
+++ b/mod/pages/actions/pages/delete.php
@@ -2,36 +2,39 @@
/**
* Remove a page
*
+ * Subpages are not deleted but are moved up a level in the tree
+ *
* @package ElggPages
*/
-$page = get_input('page');
-
-if ($page = get_entity($page)) {
-
+$guid = get_input('guid');
+$page = get_entity($guid);
+if ($page) {
if ($page->canEdit()) {
-
$container = get_entity($page->container_guid);
// Bring all child elements forward
- $parent = $page->parent_guid;
- if ($children = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $page->getGUID()))) {
- foreach($children as $child) {
- $child->parent_guid = $parent;
- }
+ $parent = $page->parent_guid;
+ $children = elgg_get_entities_from_metadata(array(
+ 'metadata_name' => 'parent_guid',
+ 'metadata_value' => $page->getGUID()
+ ));
+ if ($children) {
+ foreach ($children as $child) {
+ $child->parent_guid = $parent;
}
- if ($page->delete()) {
- system_message(elgg_echo('pages:delete:success'));
- if ($parent) {
- if ($parent = get_entity($parent)) {
- forward($parent->getURL());
- }
+ }
+
+ if ($page->delete()) {
+ system_message(elgg_echo('pages:delete:success'));
+ if ($parent) {
+ if ($parent = get_entity($parent)) {
+ forward($parent->getURL());
}
- forward("pg/pages/owned/$container->username/");
}
-
+ forward("pg/pages/owned/$container->username/");
+ }
}
-
}
register_error(elgg_echo('pages:delete:failure'));