The account object in views_plugin_argument_validate_user.inc is not correctly constructed.
There is a typo which prevents the proper initialisation of the roles array.
Also, the roles probably do not need to be explicitly loaded in all cases since the roles are already part of the user object.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | views-d7-role-issue.patch | 1.3 KB | CalebD |
| #6 | views-d6-role-issue.patch | 1.29 KB | CalebD |
| #3 | 815392_views_6_3.patch | 1.02 KB | avpaderno |
| #3 | 815392_views_7_3.patch | 1.03 KB | avpaderno |
| #2 | 815392_views_6_2.patch | 1.09 KB | avpaderno |
Comments
Comment #1
merlinofchaos commentedAssigning so I can find this again.
Comment #2
avpadernoThis is the patch for Views 6.x-2.x.
Comment #3
avpadernoThese are the patch for the other development snapshots.
The patches simply fix the typo.
Comment #4
merlinofchaos commentedCommitted to all branches. Thanks!
Comment #6
CalebD commentedAfter updating to the latest version of views I was having an issue where some views acted as if they were empty. After some debugging, I traced it back to the code change implemented by this bug fix. I don't think the fix here is entirely correct. The bug fix actually causes views to wipe out the user roles of the global user object.
$account->rolesshould only be initialized if it doesn't already exist. Sometimes$accountis a reference to the global user object, which will already have its roles populated.The roles array structure is incorrect. The current code just ads the role ID to the array, but the proper structure is to use the role ID as the array key and the role name as the value.
Attached are two patches against 7.x-3.x-dev and 6.x-3.x-dev.
Note the original poster actually points this out:
Comment #7
dawehnerStuff like this is always aready reported :) See #832954-32: global $user->roles get changed by argument_user_validate
Thanks for writing a patch.