function og_list_users_page in Organic groups 5.3
Same name and namespace in other branches
- 5.8 og.module \og_list_users_page()
- 5 og.module \og_list_users_page()
- 5.2 og.module \og_list_users_page()
- 5.7 og.module \og_list_users_page()
File
- ./
og.module, line 941
Code
function og_list_users_page($gid) {
$node = node_load($gid);
$access = og_is_node_admin($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 members second, regular members last. Alphabetize within each of these categories */
$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('Remove'), "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('Members') . ': ' . l($node->title, "node/{$node->nid}"));
return $output;
}