function og_list_users_sql in Organic groups 6.2
Same name and namespace in other branches
- 5.8 og.module \og_list_users_sql()
- 5 og.module \og_list_users_sql()
- 5.2 og.module \og_list_users_sql()
- 5.3 og.module \og_list_users_sql()
- 5.7 og.module \og_list_users_sql()
- 6 og.module \og_list_users_sql()
Generates SQL for use by other functions.
Parameters
$min_is_active: (Default: 1) Include active users. Set to 0 to include blocked users.
$min_is_admin: (Default: 0) Include all users. Set to 1 to include only administrators.
$orderby: (Default: u.name ASC - Alphabetical by user name) SQL snippet for sort order.
$count: (Default: FALSE) If TRUE, will return a count of users instead of user info.
Return value
string
7 calls to og_list_users_sql()
- og_activity_messages_alter in includes/
og.activity.inc - Implementation of hook_activity_messages_alter().
- og_broadcast_form_submit in ./
og.pages.inc - og_node_delete_move_memberships in ./
og.module - Submit handler for group node delete form.
- og_subscriber_count_link in ./
og.module - Determine the number of active and pending members and the current user's membership state.
- og_subscribe_user in ./
og.module - Create a new membership for a given user to given group.
File
- ./
og.module, line 1130 - Code for the Organic Groups module.
Code
function og_list_users_sql($min_is_active = 1, $min_is_admin = 0, $orderby = 'u.name ASC', $count = FALSE) {
$order = '';
if ($count) {
$fields = 'COUNT(*)';
}
else {
$fields = "u.uid, u.name, u.mail, u.picture, ou.*";
if ($orderby) {
$order = "ORDER BY {$orderby}";
}
}
return db_rewrite_sql("SELECT {$fields} FROM {og_uid} ou INNER JOIN {users} u ON ou.uid = u.uid WHERE ou.nid = %d AND u.status > 0 AND ou.is_active >= {$min_is_active} AND ou.is_admin >= {$min_is_admin} {$order}", 'u', 'uid');
}