function og_subscriber_count_link in Organic groups 5
Same name and namespace in other branches
- 5.8 og.module \og_subscriber_count_link()
- 5.3 og.module \og_subscriber_count_link()
- 5.7 og.module \og_subscriber_count_link()
- 6.2 og.module \og_subscriber_count_link()
- 6 og.module \og_subscriber_count_link()
Determine the number of active and pending members and the current user's membership state.
Return value
array An array containing two strings. One for the number of members and another containing 'active' or 'requested'
1 call to og_subscriber_count_link()
File
- ./
og.module, line 2663
Code
function og_subscriber_count_link($node) {
global $user;
$result = db_query(og_list_users_sql(0), $node->nid);
$cntall = db_num_rows($result);
$cntpending = 0;
while ($row = db_fetch_object($result)) {
if ($row->is_active == 0) {
$cntpending++;
}
if ($row->uid == $user->uid) {
if ($row->is_active) {
$subscription = 'active';
}
else {
$subscription = 'requested';
}
}
}
$txt = format_plural($cntall - $cntpending, '1 member', '@count members');
$txt = og_is_picture() ? l($txt, "og/users/{$node->nid}/faces") : l($txt, "og/users/{$node->nid}");
$txt .= $cntpending ? " ({$cntpending})" : '';
return array(
$txt,
$subscription,
);
}