From 2e132718f5d38eb0cdb23aaa0bc888a33c123d4e Mon Sep 17 00:00:00 2001 From: Juho Jaakkola Date: Thu, 18 Apr 2013 11:31:19 +0300 Subject: Fixes 5370: Uses correct container when adding files through embed. --- mod/embed/start.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/embed/start.php b/mod/embed/start.php index e8a3f8c14..2ece9d2c4 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -39,10 +39,12 @@ function embed_longtext_menu($hook, $type, $items, $vars) { } $url = 'embed'; - if (elgg_get_page_owner_guid()) { - $url = 'embed?container_guid=' . elgg_get_page_owner_guid(); + + $page_owner = elgg_get_page_owner_entity(); + if (elgg_instanceof($page_owner, 'group') && $page_owner->isMember()) { + $url = 'embed?container_guid=' . $page_owner->getGUID(); } - + $items[] = ElggMenuItem::factory(array( 'name' => 'embed', 'href' => $url, @@ -95,7 +97,12 @@ function embed_page_handler($page) { $container_guid = (int)get_input('container_guid'); if ($container_guid) { - elgg_set_page_owner_guid($container_guid); + $container = get_entity($container_guid); + + if (elgg_instanceof($container, 'group') && $container->isMember()) { + // embedding inside a group so save file to group files + elgg_set_page_owner_guid($container_guid); + } } echo elgg_view('embed/layout'); -- cgit v1.2.3