function gauth_user_services_load in Google Auth 7
Same name and namespace in other branches
- 7.2 gauth_user/gauth_user.module \gauth_user_services_load()
Get an array of all accounts or load a specific account.
@returns An array of accounts and their details.
Parameters
string $account_id: Name or id of the account to be loaded
bool $by_name: Set False if passing account id and True for account name
array $fields: Array of fields to be retrieved from the database
7 calls to gauth_user_services_load()
- gauth_user_auth_services_enabled in gauth_user/
gauth_user.module - Function returns the permission or the account types allowed for a user.
- gauth_user_permission in gauth_user/
gauth_user.module - Implements hook_permission().
- gauth_user_services_edit_form in gauth_user/
gauth_user.admin.inc - Form builder; Edit an services account.
- gauth_user_services_edit_form_validate in gauth_user/
gauth_user.admin.inc - Validate handler for adding a new account to google auth services accounts.
- gauth_user_services_save in gauth_user/
gauth_user.module - Save an account.
File
- gauth_user/
gauth_user.module, line 138 - Google Auth Api for drupal.
Code
function gauth_user_services_load($account_id = NULL, $by_name = TRUE, $fields = 'gauth_user_services') {
$accounts = array();
if ($by_name) {
$filter = 'name';
}
else {
$filter = 'id';
}
$query = db_select('gauth_user_services');
if (is_array($fields)) {
$query
->fields('gauth_user_services', $fields);
}
else {
$query
->fields('gauth_user_services');
}
if ($account_id) {
$accounts = $query
->condition($filter, $account_id, '=')
->execute()
->fetchAssoc();
}
else {
$accounts = $query
->orderBy('id')
->execute()
->fetchAllAssoc($filter);
}
return $accounts;
}