function _token_example_get_user

Same name in other branches
  1. 7.x-1.x 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

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;
}