aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-31 22:16:05 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-31 22:16:05 +0000
commit10136dab54a59af57071c56e11e5ac2b394b0a2a (patch)
tree0bd2073814d705ffc5491bbc53c2d0d8b4954f5b
parent883ff9d64ad1d2db99bb4a3207eace3998faf35a (diff)
downloadelgg-10136dab54a59af57071c56e11e5ac2b394b0a2a.tar.gz
elgg-10136dab54a59af57071c56e11e5ac2b394b0a2a.tar.bz2
Fixes #1164: can_write_to_container() now sends default values through container_permissions_check hook.
git-svn-id: http://code.elgg.org/elgg/trunk@3871 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--CHANGES.txt1
-rw-r--r--engine/lib/entities.php10
2 files changed, 6 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index d88332adf..a224c21cf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -35,6 +35,7 @@ http://code.elgg.org/elgg/.....
* unregister_elgg_event_handler() and unregister_plugin_hook() added. #1465
* clear_all_plugin_settings() added.
* get_entity_relationships() supports inverse relationships. #1472.
+ * can_write_to_container() can be overridden with the container_permissions_check hook. #1164 (part 2).
Services API:
* Separated user and api authenticate processing
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index fe6017e1b..59dc65658 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1471,7 +1471,7 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_typ
$container_guid = page_owner();
}
if (!$container_guid) {
- return true;
+ $return = TRUE;
}
$container = get_entity($container_guid);
@@ -1479,21 +1479,21 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_typ
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.
if ($user && $container instanceof ElggGroup) {
if (!$container->isMember($user)) {
- return false;
+ $return = FALSE;
} else {
- return true;
+ $return = TRUE;
}
}
// See if anyone else has anything to say
return trigger_plugin_hook('container_permissions_check', $entity_type,
- array('container' => $container, 'user' => $user), false);
+ array('container' => $container, 'user' => $user), $return);
}
return false;