From 1af60ae2122e23b0a73ebe88ab448866927a6a92 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 11 Jun 2011 14:15:43 +0000 Subject: Fixes #2672 limiting deleting pages and creating sub pages git-svn-id: http://code.elgg.org/elgg/trunk@9170 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/pages/pages/pages/view.php | 2 +- mod/pages/start.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'mod/pages') diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php index b9f1fde83..b73bc985c 100644 --- a/mod/pages/pages/pages/view.php +++ b/mod/pages/pages/pages/view.php @@ -33,7 +33,7 @@ $content = elgg_view_entity($page, true); $content .= elgg_view_comments($page); $buttons = ''; -if ($page->canEdit()) { +if (elgg_get_logged_in_user_guid() == $page->getOwnerGuid()) { $url = "pages/add/$page->guid"; $buttons = elgg_view('output/url', array( 'text' => elgg_echo('pages:newchild'), diff --git a/mod/pages/start.php b/mod/pages/start.php index 2e2bc1ed6..fded5fee9 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -231,6 +231,15 @@ function pages_entity_menu_setup($hook, $type, $return, $params) { return $return; } + // remove delete if not owner or admin + if (!elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != $entity->getOwnerGuid()) { + foreach ($return as $index => $item) { + if ($item->getName() == 'delete') { + unset($return[$index]); + } + } + } + $options = array( 'name' => 'history', 'text' => elgg_echo('pages:history'), -- cgit v1.2.3