From: Juho Jaakkola Date: Thu, 18 Apr 2013 08:31:19 +0000 (+0300) Subject: Fixes 5370: Uses correct container when adding files through embed. X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2e132718f5d38eb0cdb23aaa0bc888a33c123d4e;p=lorea%2Felgg.git Fixes 5370: Uses correct container when adding files through embed. --- 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');