function private_files_download_permission_get_users in Private files download permission 7.2
Returns a standard array containing all users.
2 calls to private_files_download_permission_get_users()
- private_files_download_permission_get_directory_form in ./
private_files_download_permission.module - (Form callback.) Displays a form to add/edit a directory.
- private_files_download_permission_list_directories in ./
private_files_download_permission.module - (Page callback.) Displays the main page and lists directories under control.
File
- ./
private_files_download_permission.module, line 87 - Handles both module settings and its behaviour.
Code
function private_files_download_permission_get_users() {
// Load user list from cache (if enabled) or from database.
if (variable_get('private_files_download_permission_cache_users', FALSE) && ($cache = cache_get(__FUNCTION__))) {
$users = $cache->data;
}
else {
// Get raw data.
$user_list = db_select('users', 't')
->fields('t')
->orderBy('t.name', 'ASC')
->execute()
->fetchAllAssoc('uid');
// Prepare a standard (uid, name) array.
$users = array();
foreach ($user_list as $uid => $user) {
$users[$uid] = !$user->name ? t('anonymous user') : $user->name;
}
// Set cache values.
cache_set(__FUNCTION__, $users);
}
return $users;
}