function og_list_users_page in Organic groups 5.2
Same name and namespace in other branches
- 5.8 og.module \og_list_users_page()
- 5 og.module \og_list_users_page()
- 5.3 og.module \og_list_users_page()
- 5.7 og.module \og_list_users_page()
File
- ./
og.module, line 896
Code
function og_list_users_page($gid) {
$node = node_load($gid);
$access = node_access('update', $node);
if ($access) {
$header[] = array(
'data' => t('Operations'),
'colspan' => 2,
);
}
// prepend the group manager
$i = 0;
$rows[$i][] = array(
'data' => theme('username', $node) . ' <em>' . t('manager') . '</em>',
'colspan' => 3,
);
$i++;
$sql = og_list_users_sql(0, 0, 'ou.is_admin DESC, ou.is_active ASC, u.name ASC');
/* list group admins first, pending subscribers second, regular subscribers last. Alphabetize within each of these catergories */
$result = pager_query($sql, 500, 0, NULL, $gid);
while ($account = db_fetch_object($result)) {
if ($account->uid != $node->uid) {
$username = theme('username', $account);
if (!$account->is_active) {
$username .= ' <em>' . t('(approval needed)') . '</em>';
}
elseif ($account->is_admin) {
$username .= ' <em>' . t('administrator') . '</em>';
}
$rows[$i][] = $username;
if ($access) {
if ($account->is_active) {
$rows[$i][] = l(t('unsubscribe'), "og/unsubscribe/{$gid}/{$account->uid}", array(), "destination=og/users/{$gid}");
if ($account->is_admin) {
$rows[$i][] = l(t('admin: remove'), "og/delete_admin/{$gid}/{$account->uid}", array(), 'destination=' . $_GET['q']);
}
else {
$rows[$i][] = l(t('admin: create'), "og/create_admin/{$gid}/{$account->uid}", array(), 'destination=' . $_GET['q']);
}
}
else {
$rows[$i][] = l(t('approve'), "og/approve/{$gid}/{$account->uid}", array(), "destination=og/users/{$gid}");
$rows[$i][] = l(t('deny'), "og/deny/{$gid}/{$account->uid}", array(), "destination=og/users/{$gid}");
}
}
$i++;
}
}
if ($pager = theme('pager', NULL, 500)) {
$rows[$i][] = array(
'data' => $pager,
'colspan' => 2,
);
}
$header = array();
$output = theme('table', $header, $rows);
$bc[] = array(
'path' => "og",
'title' => t('Groups'),
);
$bc[] = array(
'path' => "node/{$gid}",
'title' => $node->title,
);
menu_set_location($bc);
drupal_set_title(t('Subscribers') . ': ' . l($node->title, "node/{$node->nid}"));
return $output;
}