function user_patterns_get_arguments in Patterns 7
File
- patterns_components/
components/ user.inc, line 95
Code
function user_patterns_get_arguments($action, $tag, $form_id, &$loop = FALSE) {
$return = array();
$loop = TRUE;
if ($form_id == 'user_profile_form') {
$query = db_select('users', 'u');
$query
->condition('u.uid', 0, '<>');
$query = $query
->extend('PagerDefault')
->extend('TableSort');
$query
->fields('u', array(
'uid',
));
$result = $query
->execute()
->fetchAll();
foreach ($result as $account) {
$user = user_load($account->uid);
array_push($return, array(
$user,
));
}
}
elseif ($form_id == 'user_admin_role') {
$roles = user_roles();
foreach ($roles as $rid => $name) {
if (!($rid == DRUPAL_ANONYMOUS_RID || $rid == DRUPAL_AUTHENTICATED_RID)) {
array_push($return, array(
(object) array(
'rid' => $rid,
'name' => $name,
'weight' => 0,
),
));
}
}
}
elseif ($form_id == 'user_admin_permissions') {
$roles = user_roles();
foreach ($roles as $rid => $name) {
if (!($rid == DRUPAL_ANONYMOUS_RID || $rid == DRUPAL_AUTHENTICATED_RID)) {
array_push($return, array(
$rid,
));
}
}
}
return $return;
}