summaryrefslogtreecommitdiff
path: root/classes/User_group.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/User_group.php')
-rwxr-xr-xclasses/User_group.php40
1 files changed, 36 insertions, 4 deletions
diff --git a/classes/User_group.php b/classes/User_group.php
index e0b6f2885..06c031610 100755
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -29,24 +29,28 @@ class User_group extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
- function defaultLogo($size) {
+ function defaultLogo($size)
+ {
static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
AVATAR_STREAM_SIZE => 'stream',
AVATAR_MINI_SIZE => 'mini');
return theme_path('default-avatar-'.$sizenames[$size].'.png');
}
- function homeUrl() {
+ function homeUrl()
+ {
return common_local_url('showgroup',
array('nickname' => $this->nickname));
}
- function permalink() {
+ function permalink()
+ {
return common_local_url('groupbyid',
array('id' => $this->id));
}
- function getNotices($offset, $limit) {
+ function getNotices($offset, $limit)
+ {
$qry =
'SELECT notice.* ' .
'FROM notice JOIN group_inbox ON notice.id = group_inbox.notice_id ' .
@@ -55,4 +59,32 @@ class User_group extends Memcached_DataObject
'group:notices:'.$this->id,
$offset, $limit);
}
+
+ function allowedNickname($nickname)
+ {
+ static $blacklist = array('new');
+ return !in_array($nickname, $blacklist);
+ }
+
+ function getMembers($offset=0, $limit=null)
+ {
+ $qry =
+ 'SELECT profile.* ' .
+ 'FROM profile JOIN group_member '.
+ 'ON profile.id = group_member.profile_id ' .
+ 'WHERE group_member.group_id = %d ' .
+ 'ORDER BY group_member.created DESC ';
+
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+
+ $members = new Profile();
+
+ $cnt = $members->query(sprintf($qry, $this->id));
+
+ return $members;
+ }
}