aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-04-21 08:32:38 -0700
committerCash Costello <cash.costello@gmail.com>2013-04-21 08:32:38 -0700
commit27876994f5931f3d7b1348e4190dedbe68223239 (patch)
treeaa612cd7f8954ca760f37a4c49d4e1d56f2a8500 /mod
parentf6e70740d7601af0ff64e4ca2e683a7c9c650e95 (diff)
parent2e132718f5d38eb0cdb23aaa0bc888a33c123d4e (diff)
downloadelgg-27876994f5931f3d7b1348e4190dedbe68223239.tar.gz
elgg-27876994f5931f3d7b1348e4190dedbe68223239.tar.bz2
Merge pull request #5371 from juho-jaakkola/embed-container
Fixes 5370: Uses correct container when adding files through embed.
Diffstat (limited to 'mod')
-rw-r--r--mod/embed/start.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/mod/embed/start.php b/mod/embed/start.php
index fb6b8ac84..e14e0efd4 100644
--- a/mod/embed/start.php
+++ b/mod/embed/start.php
@@ -42,10 +42,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,
@@ -98,7 +100,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');