Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
19 Jul 2006 at 22:10 UTC
Updated:
5 Feb 2008 at 15:28 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedWouldn't it be better to actually utilize the roles, since we can check $user->uid for them?
Comment #2
fagoThat's right.
There is an entry for anonymous users in the users_roles table, so only the role for authenticated users needs a special handling.
The attached patch adds a custom handler for this. To enable reusing of existing code I created a function views_handler_filter_default(), which does the default filter handling. I left this function in views_query.inc directly under the original code, hopefully that's ok so?
Further I stripped the function views_handler_filter_usercurrent_custom, which isn't used any more.
Comment #3
merlinofchaos commentedHunk #2 of this patch failed to apply for me. How odd.
Comment #4
fagooh sorry, there were some conflicts with the table alias prefix patch.
I've attached a new patch made with a clean views-head install. It includes some further tiny code improvements.
Comment #5
merlinofchaos commentedOk, this is my fault, I let this sit too long, and naturally it won't apply anymore. :P I think I lost this one in the heaviness of my queue.
Can you do me a favor? Split this into two patches -- the cleanups really need to be a patch on their own. I think I like what you did but I don't want it tied to this, which is a much simpler issue.
Comment #6
fagohm, yeah it would made sense to split it, however this patch wouldn't be as simple if the other one isn't in, because then I would have to copy these default filter handling code to the custom handler too...
so to simplify it I would like to reroll it and either
* keep it together or
* make two patches, where the second one depends on the other one, which introduces views_handler_filter_default()
Comment #7
merlinofchaos commentedA dependency is ok.
Comment #8
fagook, here is the first part of the patch, which introduces views_handler_filter_default(), so that custom filter implementations could reuse it.
attached is the patch for 5.x
Comment #9
fagoand here is the one for 4.7
Comment #10
fagohere is a patch for 4.7, that fixes the role: author by role filter for 4.7 for all possible operations and roles.
it also moves the views_handler_filter_role() function to the user.inc, the only places where it is used and it removes the unused function views_handler_filter_usercurrent_custom().
I also wanted to make a patch for 5.x for this changes, however there is problem: drupal 5.x doesn't include the anonymous role 1 in the user roles table anymore. it got deleted with system_update_171. so this makes things rather difficult, but I'll have a look at it tomorrow.
Comment #11
fagoso, it's done. attached is a patch for 5.0 which also fixes the role: author by role filter for all possible operations and roles :)
as the patch for 4.7 it also moves the views_handler_filter_role() function to the user.inc, the only places where it is used and it removes the unused function views_handler_filter_usercurrent_custom().
Comment #12
fagohere it is
Comment #13
fagoand here is an updated patch for 4.7 - now it makes also use of the drupal constants DRUPAL_ANONYMOUS_RID and DRUPAL_AUTHENTICATED_RID for better readibility.
Comment #14
merlinofchaos commentedHey, guess what...once again the patch didn't apply!
Just kidding. It's in. =)
Comment #15
(not verified) commentedComment #16
RobRoy commentedI'm getting Fatal error: Call to undefined function views_handler_filter_default() in ....views\modules\views_user.inc on line 475 on a fresh update of DRUPAL-5. Is there another patch waiting to go in or did this not get backported correctly?
Comment #17
fagobackport? this is in views 5.x and it is working fine for me.
If you are manually applying these patches apply both! (Read the whole issue.)
Comment #18
RobRoy commentedThe version was set to HEAD, so I thought it might have been committed to HEAD and not backported to DRUPAL-5. I did a clean update of DRUPAL-5 and got this error. I'll see if I can find a generic View to reproduce (as mine uses custom field types).
Comment #19
merlinofchaos commentedCrap, he's right. views_handler_filter_default() doesn't appear anywhere in current views -dev. And my memory is spotty on where that function originally appeared.
Comment #20
fagoah, indeed. sry robroy..
Puh, what a zombie! Let's kill this issue merlin ;)
You forgot to commit the patches from the comments #8 and #9.
Comment #21
merlinofchaos commentedHmm. Looks like I committed this on 4/12 and forgot to mark it fixed.
Comment #22
(not verified) commentedComment #23
deekayen commentedJust for the record, it wasn't 4/12 (since I looked for it there), it was CVS revisions 1.11.2.4 and 1.14.2.6 on Sat, Mar 3, 2007. I'm still having issues related to usernode, but will take that up at http://drupal.org/node/99726