From 5b0f0472efc28345d7a7398c3178b857b8f4091d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 8 Oct 2011 20:35:10 -0400 Subject: Fixes #3943 returning false in can_write_to_container() if container does not exist --- engine/lib/entities.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engine/lib/entities.php') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index c94acbf08..78fa915dd 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -452,8 +452,10 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al $container_guid = elgg_get_page_owner_guid(); } + $return = false; + if (!$container_guid) { - $return = TRUE; + $return = true; } $container = get_entity($container_guid); @@ -461,16 +463,16 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al if ($container) { // If the user can edit the container, they can also write to it if ($container->canEdit($user_guid)) { - $return = TRUE; + $return = true; } // Basics, see if the user is a member of the group. // @todo this should be moved to the groups plugin/library if ($user && $container instanceof ElggGroup) { if (!$container->isMember($user)) { - $return = FALSE; + $return = false; } else { - $return = TRUE; + $return = true; } } } -- cgit v1.2.3