function og_block_subscribers in Organic groups 5.2
Same name and namespace in other branches
- 5.8 og.module \og_block_subscribers()
- 5 og.module \og_block_subscribers()
- 5.3 og.module \og_block_subscribers()
- 5.7 og.module \og_block_subscribers()
1 call to og_block_subscribers()
- og_block in ./
og.module - Implementation of hook_block().
File
- ./
og.module, line 2142
Code
function og_block_subscribers() {
global $user;
if ($group_node = og_get_group_context()) {
$gid = $group_node->nid;
// only members can see subscriber list
if (in_array($gid, array_keys($user->og_groups))) {
$max = variable_get('og_block_cnt_2', 10);
$sql = "SELECT DISTINCT(u.uid), u.* FROM {og_uid} ogu INNER JOIN {users} u ON ogu.uid = u.uid WHERE ogu.nid = %d ORDER BY ogu.created DESC";
$result = db_query_range($sql, $gid, 0, $max);
while ($row = db_fetch_object($result)) {
if (og_is_picture()) {
//showing member pictures
$link = theme('user_picture', $row) . theme('username', $row);
}
else {
$link = theme('username', $row);
}
$links[] = $link;
}
if ($links) {
if (count($links) > $max - 1) {
array_pop($links);
$txt = t('more');
$title = array(
'title' => t('View all subscribers.'),
);
$more = og_is_picture() ? l($txt, "og/users/{$gid}/faces", $title) : l($txt, "og/users/{$gid}", $title);
$append = "<div class=\"more-link\">{$more}</div>";
}
$block['content'] = theme('item_list', $links) . $append;
$block['subject'] = t('Recently joined');
return $block;
}
}
}
}