From 250e367c61b55ee4399e2b4ee49b940512b24b53 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 23 Mar 2011 00:02:33 +0000 Subject: Fixes #3218 group content pages now use container method to determine who can add content git-svn-id: http://code.elgg.org/elgg/trunk@8818 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/page/layouts/content/header.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'views/default/page') diff --git a/views/default/page/layouts/content/header.php b/views/default/page/layouts/content/header.php index e9c099b70..4c63009f4 100644 --- a/views/default/page/layouts/content/header.php +++ b/views/default/page/layouts/content/header.php @@ -27,18 +27,19 @@ if ($context) { } else { if (elgg_is_logged_in() && $context) { $owner = elgg_get_page_owner_entity(); - if (elgg_instanceof($owner, 'group')) { + if (!$owner) { + // this is probably an all page + $owner = elgg_get_logged_in_user_entity(); + } + if ($owner && $owner->canWriteToContainer()) { $guid = $owner->getGUID(); - } else { - $guid = elgg_get_logged_in_user_guid(); + elgg_register_menu_item('title', array( + 'name' => 'add', + 'href' => elgg_extract('new_link', $vars, "$context/add/$guid"), + 'text' => elgg_echo("$context:add"), + 'class' => 'elgg-button elgg-button-action', + )); } - - elgg_register_menu_item('title', array( - 'name' => 'add', - 'href' => elgg_extract('new_link', $vars, "$context/add/$guid"), - 'text' => elgg_echo("$context:add"), - 'class' => 'elgg-button elgg-button-action', - )); } $buttons = elgg_view_menu('title', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); -- cgit v1.2.3