function _token_example_get_user in Examples for Developers 6
Same name and namespace in other branches
- 7 token_example/token_example.module \_token_example_get_user()
Build a list of availalbe user accounts.
Related topics
File
- token_example/
token_example.module, line 199 - The Token API module.
Code
function _token_example_get_user() {
if (!user_access('access user profiles') && !user_access('administer users')) {
return array();
}
$sql = 'SELECT u.uid, u.name FROM {users} u WHERE u.uid > 0 AND u.status = 1';
$query = db_query_range($sql, 0, 1);
$accounts = array();
while ($result = db_fetch_object($query)) {
$accounts[$result->uid] = $result->name;
}
$accounts = array_map('check_plain', $accounts);
return $accounts;
}