From e04c580e7064c24104f29a8aed295381c351b4a4 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 1 Jan 2012 19:29:17 -0500 Subject: Fixes #3939 if user does not have permissions to see the name of the access collection, it is shown as "Limited" --- engine/lib/access.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'engine/lib/access.php') diff --git a/engine/lib/access.php b/engine/lib/access.php index 08b9283cd..7be92fbfc 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -838,7 +838,7 @@ function elgg_list_entities_from_access_id(array $options = array()) { * * @param int $entity_access_id The entity's access id * - * @return string 'Public', 'Private', etc. or false if error. + * @return string 'Public', 'Private', etc. * @since 1.7.0 * @todo I think this probably wants get_access_array() instead of get_write_access_array(), * but those two functions return different types of arrays. @@ -849,15 +849,12 @@ function get_readable_access_level($entity_access_id) { //get the access level for object in readable string $options = get_write_access_array(); - //@todo Really? Use array_key_exists() - foreach ($options as $key => $option) { - if ($key == $access) { - $entity_acl = htmlentities($option, ENT_QUOTES, 'UTF-8'); - return $entity_acl; - break; - } + if (array_key_exists($access, $options)) { + return $options[$access]; } - return false; + + // return 'Limited' if the user does not have access to the access collection + return elgg_echo('access:limited:label'); } /** -- cgit v1.2.3