aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-23 22:25:32 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-23 22:25:32 +0000
commit302e5136f804aaa7d6bebb133767bfcbda249564 (patch)
treeab47329916f7e8b2635ce0b6981d068044f8ca61 /engine/classes
parent3851aab30105f1b35eb344b30181b3427046db80 (diff)
downloadelgg-302e5136f804aaa7d6bebb133767bfcbda249564.tar.gz
elgg-302e5136f804aaa7d6bebb133767bfcbda249564.tar.bz2
Added list groups and list friends class methods - will be handy for federation
git-svn-id: http://code.elgg.org/elgg/trunk@7715 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes')
-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