Permalink
Browse files

feature(plugins): listing of 'my' content shows content you own

BREAKING CHANGE:
The plugins blog, bookmarks and file have been changed to have their
content listing for "Mine" and "Friends" list content where they are the
owner of. Previously it only listed content created in their container.
This resulted in group content not showing in 'my' content listings.

Fixes #4878
  • Loading branch information...
jdalsem committed Jul 2, 2015
1 parent 48fd539 commit 20e606b79fcb97d7969c82ad5650b32e47acb225
View
@@ -32,10 +32,11 @@ function blog_get_page_content_list($container_guid = NULL) {
// access check for closed groups
elgg_group_gatekeeper();
- $options['container_guid'] = $container_guid;
$container = get_entity($container_guid);
- if (!$container) {
-
+ if ($container instanceof ElggGroup) {
+ $options['container_guid'] = $container_guid;
+ } else {
+ $options['owner_guid'] = $container_guid;
}
$return['title'] = elgg_echo('blog:title:user_blogs', array($container->name));
@@ -104,8 +105,10 @@ function blog_get_page_content_archive($owner_guid, $lower = 0, $upper = 0) {
'distinct' => false,
);
- if ($owner_guid) {
+ if ($owner instanceof ElggGroup) {
$options['container_guid'] = $owner_guid;
+ } elseif ($owner instanceof ElggUser) {
+ $options['owner_guid'] = $owner_guid;
}
if ($lower) {
@@ -24,7 +24,7 @@
'full_view' => false,
'relationship' => 'friend',
'relationship_guid' => $user->getGUID(),
- 'relationship_join_on' => 'container_guid',
+ 'relationship_join_on' => 'owner_guid',
'no_results' => elgg_echo('blog:none'),
'preload_owners' => true,
'preload_containers' => true,
@@ -23,7 +23,7 @@
'full_view' => false,
'relationship' => 'friend',
'relationship_guid' => $page_owner->guid,
- 'relationship_join_on' => 'container_guid',
+ 'relationship_join_on' => 'owner_guid',
'no_results' => elgg_echo('bookmarks:none'),
'preload_owners' => true,
'preload_containers' => true,
@@ -15,16 +15,23 @@
elgg_register_title_button();
-$content .= elgg_list_entities(array(
+$options = [
'type' => 'object',
'subtype' => 'bookmarks',
- 'container_guid' => $page_owner->guid,
'full_view' => false,
'view_toggle_type' => false,
'no_results' => elgg_echo('bookmarks:none'),
'preload_owners' => true,
'distinct' => false,
-));
+];
+
+if ($page_owner instanceof ElggGroup) {
+ $options['container_guid'] = $page_owner->guid;
+} else {
+ $options['owner_guid'] = $page_owner->guid;
+}
+
+$content .= elgg_list_entities($options);
$title = elgg_echo('bookmarks:owner', array($page_owner->name));
@@ -24,7 +24,7 @@
'full_view' => false,
'relationship' => 'friend',
'relationship_guid' => $owner->guid,
- 'relationship_join_on' => 'container_guid',
+ 'relationship_join_on' => 'owner_guid',
'no_results' => elgg_echo("file:none"),
'preload_owners' => true,
'preload_containers' => true,
@@ -35,15 +35,22 @@
$title = elgg_echo("file:user", array($owner->name));
// List files
-$content = elgg_list_entities(array(
+$options = [
'type' => 'object',
'subtype' => 'file',
- 'container_guid' => $owner->guid,
'full_view' => false,
'no_results' => elgg_echo("file:none"),
'preload_owners' => true,
'distinct' => false,
-));
+];
+
+if ($owner instanceof ElggGroup) {
+ $options['container_guid'] = $owner->guid;
+} else {
+ $options['owner_guid'] = $owner->guid;
+}
+
+$content = elgg_list_entities($options);
$sidebar = file_get_type_cloud(elgg_get_page_owner_guid());
$sidebar .= elgg_view('file/sidebar');

0 comments on commit 20e606b

Please sign in to comment.