diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-22 23:11:29 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-22 23:11:29 +0000 |
commit | da4c15449dd48b3135ac14924e04c88bed8da427 (patch) | |
tree | c8afab45e5105afc0631445572c0aa9b1a934196 /engine/classes/ElggSite.php | |
parent | 63722e11e656df0328f0051f68ad993e04b8947f (diff) | |
download | elgg-da4c15449dd48b3135ac14924e04c88bed8da427.tar.gz elgg-da4c15449dd48b3135ac14924e04c88bed8da427.tar.bz2 |
updated the deprecated list_site_members() to use new ElggSite::listMembers() method and updated ElggSite::getMembers() to accept all the arguments from elgg_get_entities()
git-svn-id: http://code.elgg.org/elgg/trunk@7422 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggSite.php')
-rw-r--r-- | engine/classes/ElggSite.php | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 93d442e0a..aa94b9fd2 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -196,22 +196,60 @@ class ElggSite extends ElggEntity { } /** - * Returns an array of ElggUser entities who are members of the site. + * Gets an array of ElggUser entities who are members of the site. * - * @param int $limit Limit - * @param int $offset Offset + * @param array $options An associative array for key => value parameters + * accepted by elgg_get_entities(). Common parameters + * include 'limit', and 'offset'. + * Note: this was $limit before version 1.8 + * @param int $offset Offset @deprecated parameter + * + * @todo remove $offset in 2.0 * * @return array of ElggUsers */ - public function getMembers($limit = 10, $offset = 0) { - return elgg_get_entities_from_relationship(array( + public function getMembers($options = array(), $offset = 0) { + if (!is_array($limit)) { + elgg_deprecated_notice("ElggSite::getMembers has a different arguments!", 1.8); + $options = array( + 'limit' => $options, + 'offset' => $offset, + ); + } + + $defaults = array( 'relationship' => 'member_of_site', 'relationship_guid' => $this->getGUID(), 'inverse_relationship' => TRUE, - 'types' => 'user', - 'limit' => $limit, - 'offset' => $offset - )); + 'type' => 'user', + ); + + $options = array_merge($defaults, $options); + + return elgg_get_entities_from_relationship($options); + } + + /** + * List the members of this site + * + * @param array $options An associative array for key => value parameters + * accepted by elgg_list_entities(). Common parameters + * include 'full_view', 'limit', and 'offset'. + * + * @return string + * @since 1.8.0 + */ + public function listMembers($options = array()) { + $defaults = array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $this->getGUID(), + 'inverse_relationship' => TRUE, + 'type' => 'user', + ); + + $options = array_merge($defaults, $options); + + return elgg_list_entities_from_relationship($options); } /** |