I'm not sure anyone else is seeing this, but on our project, views suddenly stopped respecting the rights given by the module view_unpublished on the permissions page. We are using the filter "published or admin" on all our views, and previously it respected rights given through the view_unpublished module.
I am unsure however if this has started when we upgraded these last two times to 6.x-2.10 or what is causing this. I am opening this as a support request in a hope that someone else is seeing this and so we can perhaps troubleshoot this together.
As it is right now, I am pretty hopeless on this issue, I don't see the published or admin filter changed since we started the project, and neither has the module view_unpublished.. I even tried downgrading core to the last version in hope that that a change in core was causing this.
Any pointers are extremely welcomed. Our publishers need to see how the nodes will look in section listings before going published, and I really don't feel comfortable granting the administer nodes permission to them.
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | 768206-integration_with_views-30.patch | 2.69 KB | pcambra |
| #29 | 768206-integration_with_views-29.patch | 1.67 KB | pcambra |
| #23 | 768206-23-views-integration-per-content-type.patch | 1.75 KB | hanoii |
| #10 | view_unpublished_views.zip | 1.74 KB | manuel garcia |
Comments
Comment #1
merlinofchaos commentedI don't know how the view_unpublished module works or what the permissions on it actually *are* or what would be different if using that module, so it's difficult for me to provide any guidance. Will need more details.
Comment #2
dawehnerviews never respected view_unpublished, or the other way round.
Doing something like this with hook_perm and menu item access callback, cannot integrate with views.
There is the need of hook_node_grants to achieve this, OR write a custom views handler.
Comment #3
manuel garcia commentedThanks for the quick reply!
The module is reaaaly simple, it consists of 50 lines including comments:
The module works, I mean if a publisher with the permission "View all unpublished content" goes to see an unpublished node, he can view it fine. But views listing this node will remove it if the user is not 1 (using the published or admin filter). This wasn't the case before, so something must be causing this.
I have checked the filter published or admin code, and it hasn't changed at all since the first views version we started to build this site with, so I am really at a loss here, cant see what could be causing this or how to go about troubleshooting.
Comment #4
dawehnerIt did not respect the permission. See my above comment. I cannot guess, why you thought it did.
Views generall does not integrate with other contrib module. Views is such extendable that the contrib module can make views working as it should.
Comment #5
manuel garcia commentedOops Dereine, I think we were replying at the same time -- sorry!
OK, so humm... i remember our publishers being able to see these content before, ... X file?
I see waht you mean, although I am not familiar with this side of drupal code. I know there is an issue opened about this on the view_unpublished queue, #606516: View own unpublished content and respect module_grants - though I have tested it and unfortunately the problem did not go away. I am not knowledgeable enough to review the patch properly so I guess we are stuck for now until that gets worked on properly... and the module mantainer shows up :X
Thanks guys for the quick info, really appreciate it!
Comment #6
manuel garcia commentedcross posted again sorry
Comment #7
merlinofchaos commentedThe filter in Views specifically checks the administer nodes permission. In order for view_unpublished to work, it would need to provide a replacement for this filter. It can do this using hook_views_data_alter().
I can't imagine how it ever works if view_unpublished was not providing a replacement. The filter in question is quite specific.
Comment #8
manuel garcia commentedYes, this is correct merlin, thanks.
Dereine spent some time helping me doing just that last night, and we managed. I will clean it up and provide an initial patch for view_unpublished as soon as I can.
Comment #9
chaloalvarezj commentedI think this is a great module and would like to use it, but not being able to use views would make it hard to use.
Any news with the initial patch?
Comment #10
manuel garcia commentedOK, the project is now live (you can check it out if you want at www.hobbynews.es), and is time to give back to the community, so we all prosper and conquer the world =)
Find attached the module that implements preliminary this integration. Keep in mind that we only use the "View all unpublished content" permission, so this is what we needed only. The module only takes over the query for view unpublished or admin filter, and takes into account this permission.
So there's not much to it, you just enable the module, and that permission will work with this filter automatically, nothing else to do.
It's a start, and I hope it will get in the module sometime. Feel free to discuss whether or not to put this as a separate module, and how to go about implementing this for the rest of permissions per content type.
BIG thanks to dereine for helping me get through the views maze without loosing my head too much, on a sunday night -> Big respect!
Comment #11
chaloalvarezj commentedGracias!!
Will post later when I start using this module..
Comment #12
entendu commentedRight on guys, I'll take a look at this rolling this out over the weekend.
Comment #13
amclin commentedAny progress on this? Because without views integration, this module is pretty useless for all but the simplest of scenarios.
Comment #14
westie commentedTested patch@#10 and seems to work fine for me. Can we get this included in the next module release?
Comment #15
gooddesignusa commentedsubscribing
Comment #16
1timer commentedsub
Comment #17
manuel garcia commentedJust a heads up... my code has been used in production for hobbynews.es for nearly a year now. Working fine.
Comment #18
dddave commented+1
Just tested the module in #10. Desperately needed to make this great module really useful. Thanks Manuel!
Perhaps you could try to contact the maintainer directly. It seems the maintainer hasn't revisited this module in a long time.
Comment #19
entendu commentedAdding this to the 6x branch. Nice work, Manuel!
Note on this: you have to use the "Published or Admin" filter in Views to make it work, and this only works for the "View all unpublished" permission, no support yet for the per-content-type permissions.
Comment #20
pumpkinkid commentedWeird... I just went through the same train of thought as the OP... I too could have sworn this had been working...
Either way, I could really use the functionality for the specific content types... Any idea when this might be fixed or anything specific you need help with to make this work?
Thanks!
Comment #21
jdln commentedSubscribing.
Comment #22
filiptc commentedNeed support for the per-content-type permissions very, very (very) badly... Subscribing =)
EDIT: OK, here's a loophole if you are as desperate as me and only have one content type you're struggling with on this. Open view_unpublish.module, go to line 85 and find 'view all unpublished content'. Replace it by 'view unpublished XXXXXXXXX content', where XXXXXX is the machine readable content type name. That's all, should work right out of the box with this tweak.
Comment #23
hanoiiAttached is a patch for a per content-type support.
Comment #24
manuel garcia commentedI haven't had time to test out the patch, but the code looks good to me, thanks hanoii!
Can anyone test it out properly please so we can set this to rtbc ?
Comment #25
BenK commentedSubscribing
Comment #26
ts145nera commentedsubscribe
There's a port to D7?
Comment #27
perlgal commentedI tested the patch in #23 and it works like a charm!
Thank you hanoii!
Comment #28
manuel garcia commentedComment #29
pcambraAnd here's the port for D7.
I think this one and #23 should get committed asap.
Comment #30
pcambraOops I'd missed the views handler
Comment #31
manuel garcia commentedComment #32
bforchhammer commentedFrom a quick test, the patch in #30 seems to be doing what it's supposed to... RTBC?
Comment #33
manuel garcia commentedCode makes sense to me.
Imho:
Comment #34
seattlehimay commentedCan I ask what *exactly* it is supposed to do? I have installed the patch (#30) and cleared caches.
I have a set of "unpublished resource centers" that I want to display in a view-created block to anyone that has "Resource Center: View any unpublished content" permission. This piece does not work for me. (The block appears fine, but with no results.)
If I give these users "view any unpublished content," then it will show the block with correct content--but I really don't want to give them access to *all* unpublished content.
Comment #35
entendu commented#30 is committed to the 7x-dev branch.
Comment #36
entendu commentedComment #37
entendu commented#23 is committed to 6.x branch.