Since 'user' is a core module, I'm not sure if this is really a bug or just something that requires a workaround. Here's my situation:
Working on a simple publishing workflow, I was trying to create a custom 'Who's online' block that would also show the users' roles. On the Views2 UI page I kept getting the message "Error: handler for users_roles > rid doesn't exist!". Since no amount of Googling solved my problem, I tried adding this particular handler file (from the Views 2 API documentation) in the 'views/handlers/' folder and inserting a couple of lines into the handlers.inc file. That seems to work - so now I can get the users' roles to display. I'm not sure if I should have been looking in some other place without having to tinker with the files inside the views module. Anyhow, I just learned how to make a patch file and thought I'd place a patch here - for comments - whether it's necessary at all.
How to use the patch:
- Copy the Views 2 DRUPAL-6--2-0-RC3 file to your usual modules location (such as 'sites/all/modules/') - of course, unzip and place the 'views' folder here.
- Download the views2_users_roles.patch file to the same location (sites/all/modules/) - outside the 'views' folder.
cdto the same location ('sites/all/modules/') - thepatchcommand is meant to be run from outside the views folder.- Run the patch command:
patch -p0 -i views2_users_roles.patch
Users' roles should now be available as a views field.
| Comment | File | Size | Author |
|---|---|---|---|
| views2_users_roles.patch | 2.09 KB | ramper |
Comments
Comment #1
merlinofchaos commentedThis patch is wrong. The .inc file already exists, it's just not registered. Since this is a user.module specific, it lives entirely in the modules directory; the .inc file is in modules/user and the handler should be registered from user_views_handlers(), not the global one. Fixed in HEAD.
Comment #2
ramper commentedHa! I didn't pay attention to the other directories within the views module folder. Now that I see the directory structure inside (very logical too), I guess future error messages shouldn't look so scary nor make me go on a goose hunt, I hope. And there was no issue or discussion on this point (i.e., users roles field) that I could find anywhere - hence my attempted patch.. I learn something everytime, I guess.
Comment #3
merlinofchaos commentedThere's been one other like it, but you did manage to be the first to report the users_roles handler.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.