aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggUser.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes/ElggUser.php')
-rw-r--r--engine/classes/ElggUser.php56
1 files changed, 54 insertions, 2 deletions
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php
index 0e7323e82..eca011a36 100644
--- a/engine/classes/ElggUser.php
+++ b/engine/classes/ElggUser.php
@@ -334,7 +334,7 @@ class ElggUser extends ElggEntity
/**
* Gets this user's friends
*
- * @param string $subtype Optionally, the subtype of user to filter to (leave blank for all)
+ * @param string $subtype Optionally, the user subtype (leave blank for all)
* @param int $limit The number of users to retrieve
* @param int $offset Indexing offset, if any
*
@@ -347,7 +347,7 @@ class ElggUser extends ElggEntity
/**
* Gets users who have made this user a friend
*
- * @param string $subtype Optionally, the subtype of user to filter to (leave blank for all)
+ * @param string $subtype Optionally, the user subtype (leave blank for all)
* @param int $limit The number of users to retrieve
* @param int $offset Indexing offset, if any
*
@@ -358,6 +358,32 @@ class ElggUser extends ElggEntity
}
/**
+ * Lists the user's friends
+ *
+ * @param string $subtype Optionally, the user subtype (leave blank for all)
+ * @param int $limit The number of users to retrieve
+ * @param int $offset Indexing offset, if any
+ *
+ * @return string
+ */
+ function listFriends($subtype = "", $limit = 10, $offset = 0) {
+ $options = array(
+ 'type' => 'user',
+ 'relationship' => 'friend',
+ 'relationship_guid' => $this->guid,
+ 'limit' => $limit,
+ 'offset' => $offset,
+ 'full_view' => false,
+ );
+
+ if ($subtype) {
+ $options['subtype'] = $subtype;
+ }
+
+ return elgg_list_entities_from_relationship($options);
+ }
+
+ /**
* Gets the user's groups
*
* @param string $subtype Optionally, the subtype of user to filter to (leave blank for all)
@@ -383,6 +409,32 @@ class ElggUser extends ElggEntity
}
/**
+ * Lists the user's groups
+ *
+ * @param string $subtype Optionally, the user subtype (leave blank for all)
+ * @param int $limit The number of users to retrieve
+ * @param int $offset Indexing offset, if any
+ *
+ * @return string
+ */
+ function listGroups($subtype = "", $limit = 10, $offset = 0) {
+ $options = array(
+ 'type' => 'group',
+ 'relationship' => 'member',
+ 'relationship_guid' => $this->guid,
+ 'limit' => $limit,
+ 'offset' => $offset,
+ 'full_view' => false,
+ );
+
+ if ($subtype) {
+ $options['subtype'] = $subtype;
+ }
+
+ return elgg_list_entities_from_relationship($options);
+ }
+
+ /**
* Get an array of ElggObject owned by this user.
*
* @param string $subtype The subtype of the objects, if any