You are here

function og_block_users_network in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og.module \og_block_users_network()
  2. 5.3 og.module \og_block_users_network()
  3. 5.7 og.module \og_block_users_network()
1 call to og_block_users_network()
og_block in ./og.module
Implementation of hook_block().

File

./og.module, line 2508

Code

function og_block_users_network() {
  global $user;
  if ($user->uid && count($user->og_groups)) {
    $max = variable_get('og_block_cnt_2', 10);
    $placeholders = array_fill(0, count($user->og_groups), "'%s'");
    $sql = "SELECT ogu.uid, u.name, u.picture FROM {og_uid} ogu INNER JOIN {users} u ON ogu.uid = u.uid WHERE ogu.uid != %d AND ogu.nid IN (" . implode(", ", $placeholders) . ") GROUP BY ogu.uid, u.name, u.picture ORDER BY u.name ASC";
    $args = array_keys($user->og_groups);
    array_unshift($args, $user->uid);
    $result = db_query_range($sql, $args, 0, $max);
    $block['content'] = og_user_title_list($result, NULL, FALSE);
    $block['subject'] = t('My Network');
    return $block;
  }
}