summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngie Byron2010-08-04 06:52:57 (GMT)
committerAngie Byron2010-08-04 06:52:57 (GMT)
commit086f2ea0911ee5cef66e1a405091e5797bf1f165 (patch)
tree7f69bfd737c2be36c3eadb1014352ef8ba8d0e59
parentd30b2bada72e9377b117dc317ae0a819478f0243 (diff)
#870196 by tobiasb, mitchmac, ericduran: Fixed Notice: Undefined variable: user_role_alias() in user_build_filter_query().
-rw-r--r--modules/user/user.module8
-rw-r--r--modules/user/user.test19
2 files changed, 18 insertions, 9 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 03dce06..4dea817 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -3209,13 +3209,13 @@ function user_build_filter_query(SelectQuery $query) {
if (user_access($value, $account)) {
continue;
}
- $user_role_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
- $permission_alias = $query->join('role_permission', 'p', $user_role_alias . '.rid = %alias.rid');
+ $users_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
+ $permission_alias = $query->join('role_permission', 'p', $users_roles_alias . '.rid = %alias.rid');
$query->condition($permission_alias . '.permission', $value);
}
elseif ($key == 'role') {
- $user_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
- $query->condition($user_role_alias . '.rid' , $value);
+ $users_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
+ $query->condition($users_roles_alias . '.rid' , $value);
}
else {
$query->condition($filters[$key]['field'], $value);
diff --git a/modules/user/user.test b/modules/user/user.test
index ad6020f..0fa3749 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -1062,19 +1062,28 @@ class UserAdminTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/people', $edit, t('Filter'));
// Check if the correct users show up.
- $this->assertNoText($user_a->name, t('User A not on filtered by perm admin users page'));
+ $this->assertNoText($user_a->name, t('User A not on filtered by perm admin users page'));
$this->assertText($user_b->name, t('Found user B on filtered by perm admin users page'));
$this->assertText($user_c->name, t('Found user C on filtered by perm admin users page'));
+ // Filter the users by role. Grab the system-generated role name for User C.
+ $edit['role'] = max(array_flip($user_c->roles));
+ $this->drupalPost('admin/people', $edit, t('Refine'));
+
+ // Check if the correct users show up when filtered by role.
+ $this->assertNoText($user_a->name, t('User A not on filtered by role on admin users page'));
+ $this->assertNoText($user_b->name, t('User B not on filtered by role on admin users page'));
+ $this->assertText($user_c->name, t('User C on filtered by role on admin users page'));
+
// Test blocking of a user.
- $account = user_load($user_b->uid);
- $this->assertEqual($account->status, 1, 'User B not blocked');
+ $account = user_load($user_c->uid);
+ $this->assertEqual($account->status, 1, 'User C not blocked');
$edit = array();
$edit['operation'] = 'block';
$edit['accounts[' . $account->uid . ']'] = TRUE;
$this->drupalPost('admin/people', $edit, t('Update'));
- $account = user_load($user_b->uid, TRUE);
- $this->assertEqual($account->status, 0, 'User B blocked');
+ $account = user_load($user_c->uid, TRUE);
+ $this->assertEqual($account->status, 0, 'User C blocked');
}
}