aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-12 20:23:51 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-12 20:23:51 +0000
commit9c6eb2dae8143d7b615d213869bca4b5b2456a98 (patch)
treee2ad4b7d84642fcb35fedbf81e79c1cb2a6a6005 /engine/lib
parent365e4fb08bbc5449d32e25e09face877afee4366 (diff)
downloadelgg-9c6eb2dae8143d7b615d213869bca4b5b2456a98.tar.gz
elgg-9c6eb2dae8143d7b615d213869bca4b5b2456a98.tar.bz2
Merged r6362:6366 from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@6469 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/access.php5
-rw-r--r--engine/lib/users.php6
2 files changed, 8 insertions, 3 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index fc5081ced..b8d8820e1 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -628,7 +628,7 @@ function get_user_access_collections($owner_guid, $site_guid = 0) {
* @param true|false $idonly If set to true, will only return the members' IDs (default: false)
* @return ElggUser entities if successful, false if not
*/
-function get_members_of_access_collection($collection, $idonly = false) {
+function get_members_of_access_collection($collection, $idonly = FALSE) {
global $CONFIG;
$collection = (int)$collection;
@@ -638,6 +638,9 @@ function get_members_of_access_collection($collection, $idonly = false) {
} else {
$query = "SELECT e.guid FROM {$CONFIG->dbprefix}access_collection_membership m JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid WHERE m.access_collection_id = {$collection}";
$collection_members = get_data($query);
+ if (!$collection_members) {
+ return FALSE;
+ }
foreach($collection_members as $key => $val) {
$collection_members[$key] = $val->guid;
}
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 118a96b32..fcc10133f 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -754,8 +754,10 @@ function user_remove_friend($user_guid, $friend_guid) {
// perform cleanup for access lists.
$collections = get_user_access_collections($user_guid);
- foreach ($collections as $collection) {
- remove_user_from_access_collection($friend_guid, $collection->id);
+ if ($collections) {
+ foreach ($collections as $collection) {
+ remove_user_from_access_collection($friend_guid, $collection->id);
+ }
}
return remove_entity_relationship($user_guid, "friend", $friend_guid);