You are here

function og_block_subscribers_list in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og.module \og_block_subscribers_list()
  2. 5 og.module \og_block_subscribers_list()
  3. 5.3 og.module \og_block_subscribers_list()

API function for retrieving a list of group members. Used by og and og_panels

Return value

string An HTML list.

2 calls to og_block_subscribers_list()
og_block_subscribers in ./og.module
og_panels_ct_render_callback_subscribers in includes/groupcontent.inc

File

./og.module, line 2543

Code

function og_block_subscribers_list($gid, $max = 10, $is_admin = array(
  'members',
  'admin',
), $show_more = TRUE, $show_picture = NULL) {
  $placeholders = array_fill(0, count(array_filter($is_admin)), '%d');
  $placeholders = implode(', ', $placeholders);
  $sql = "SELECT DISTINCT(u.uid), u.*, ogu.created FROM {og_uid} ogu INNER JOIN {users} u ON ogu.uid = u.uid WHERE ogu.is_admin IN ({$placeholders}) AND ogu.nid = %d AND ogu.is_active = 1 AND u.status = 1 ORDER BY ogu.created DESC";
  if (!empty($is_admin['members'])) {
    $args[] = 0;
  }
  if (!empty($is_admin['admins'])) {
    $args[] = 1;
  }
  $args[] = $gid;
  $result = db_query_range($sql, $args, 0, $max);
  return og_user_title_list($result, $gid, $show_more, $show_picture);
}