summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/context_condition_user.inc17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/context_condition_user.inc b/plugins/context_condition_user.inc
index 0e3909e..fc2ebb0 100644
--- a/plugins/context_condition_user.inc
+++ b/plugins/context_condition_user.inc
@@ -6,15 +6,24 @@
*/
class context_condition_user extends context_condition {
function condition_values() {
- return drupal_map_assoc(user_roles());
+ $values = array();
+ foreach (user_roles() as $rid => $role_name) {
+ if ($rid == DRUPAL_ANONYMOUS_RID) {
+ $values['anonymous user'] = $role_name;
+ }
+ elseif ($rid == DRUPAL_AUTHENTICATED_RID) {
+ $values['authenticated user'] = $role_name;
+ }
+ else {
+ $values[$role_name] = $role_name;
+ }
+ }
+ return $values;
}
function execute($account) {
$roles = $account->roles;
foreach ($roles as $rid => $role) {
- if ($rid == DRUPAL_ANONYMOUS_RID || $rid == DRUPAL_AUTHENTICATED_RID) {
- $role = t($role);
- }
foreach ($this->get_contexts($role) as $context) {
$this->condition_met($context, $role);
}