summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-03 19:00:02 +0000
committerBrion Vibber <brion@pobox.com>2010-03-03 19:00:02 +0000
commit3bb42d117027ebf610481ca3b0733854e0127e56 (patch)
treed0e5aa1f5fb0407879f4ba155dbfe170165a6dd6 /classes/Profile.php
parente6fd387c94f858a7cc63b90b02ad2afb135b6aba (diff)
Use poster's subscribed groups to disambiguate group linking when a remote group and a local group exist with the same name. (If you're a member of two groups with the same name though, there's not a defined winner.)
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index 470ef3320..9c2fa7a0c 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -282,6 +282,32 @@ class Profile extends Memcached_DataObject
}
}
+ function getGroups($offset=0, $limit=null)
+ {
+ $qry =
+ 'SELECT user_group.* ' .
+ 'FROM user_group JOIN group_member '.
+ 'ON user_group.id = group_member.group_id ' .
+ 'WHERE group_member.profile_id = %d ' .
+ 'ORDER BY group_member.created DESC ';
+
+ if ($offset>0 && !is_null($limit)) {
+ if ($offset) {
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+ }
+ }
+
+ $groups = new User_group();
+
+ $cnt = $groups->query(sprintf($qry, $this->id));
+
+ return $groups;
+ }
+
function avatarUrl($size=AVATAR_PROFILE_SIZE)
{
$avatar = $this->getAvatar($size);