Closed (won't fix)
Project:
View Unpublished
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
28 Aug 2008 at 07:24 UTC
Updated:
30 Oct 2014 at 23:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
somebodysysop commentedThis updated patch seems to resolve the problem of returning to the node view after edit.
Comment #2
somebodysysop commentedThe view_unpublished.module must be weighted lighter than the node.module to work. That means that the "drupal_goto" part of the code needs to be in a module that is *heavier* than the node.module, or else the "goto" will be executed before the node and other modules can do their thing.
My solution right now is to place the "goto" part of this into another module.
This needs to be in another module weighted heavier than any other module which will use hook_nodeapi('update').
Comment #3
gforce301 commentedI am not familiar with this module, however, I have written a few custom ones and I am familiar with the forms API. Could you not with a form_alter hook either:
a) Set the destination of the form to return to. This is in the forms API functionality.
b) Register an additional submit function that processes last, does not change any values, and then performs the goto.
Comment #4
entendu commentedI think gforce has the right idea of setting #redirect in the $form object
Comment #5
somebodysysop commentedCould someone provide an example of how either of these would work in this situation? Right now, this is the callback code:
Comment #6
gforce301 commentedIf I am not mistaken that chunk of code is from a menu hook. The code that produces the form is in the function node_page_edit().
You should implement hook_form_alter in a module. Docs on it are here: http://api.drupal.org/api/function/hook_form_alter/5
Docs on #redirect can be found here: http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
Comment #7
entendu commentedPatch in #1 worked fine for me. Committed.
Comment #8
nassimo3 commentedHi , is there any patch doing this with the view_unpublished-6.x-1.0 ?
Comment #9
entendu commentedCool, will take a look this weekend.
Comment #10
geerlingguy commentedSubscribe
Comment #11
cindyr commentedPlease port to D6! And if you can make it play nicely with this: http://drupal.org/node/606516 that would make my day. My week. My month!
Comment #12
physiotek commentedsame here.
i would need both those patch. but i dont know exactly how to do. i tried with node/606516 and got a bootstrap error. then did patch -R and still have the error. i had to uninstall the module :/ so it would be very appreciated if you could port both of those patch to the official release.
thanks.
Comment #13
physiotek commentedjust realized the error was due to patch changing the ownership of the file.
so node/606516 is working great but i see that the actual patch is not working anymore.
it is possible to make it work again?
thanks,
pht3k
Comment #14
geerlingguy commentedAny update on this issue? I might try to take a crack at it soon.
Comment #15
wgrunberg commentedsubscribing
Comment #16
wgrunberg commentedIs there any alternative to this proposed patch for 6.x when it comes to editing unpublished nodes?
I don't want to give Organic Groups users privileges outside of their group when editing unpublished wiki posts. I am also trying to avoid having to implement a whole work-flow system through the Workflow module, etc.
Comment #17
geerlingguy commented@#16 - I'm having the exact same dilemma... I might write some custom code for OG, or something to work in tandem with OG User Roles, to accomplish this. Hopefully I can get it done in a way that is easily sharable via a snippet or as a module...
Comment #18
joelstein commentedAttached is a patch which allows users with the proper permission to edit unpublished nodes.
Comment #19
geerlingguy commentedI had some trouble with the above patch on archstl.org - but I will look at it a little more.
Comment #20
joelstein commentedHere is an updated patch which respects the original access callback, which makes it work better with other access control modules. Also, make sure you flush your menu cache; otherwise this will patch will not work.
Comment #21
geerlingguy commentedI'm using this patch on archstl.org to allow Organic Group admins (using the OG Role Assign module as a helper) permission to edit/view any unpublished node within their group. It's working great; after applying the patch (please get this committed asap!), I just had to make sure I flushed the menu cache (if you don't do that, you'll get access denied errors).
Thanks for the help, @joelstein!
Comment #22
nancydruA bit more compact...
Comment #23
Anonymous (not verified) commentedI'm not certain where to post this suggestion since it involves two issues. First, this patch worked great and fixed a real problem on our site. Thanks!
Then I realized we didn't have access to the Revisions either. A patch is being worked on by users on this issue http://drupal.org/node/500432 and that patch also works well. However, the edit patch here and the revisions patch do not work together.
It would be wonderful to eventually have both patches added to the module and working well together eventually. I get a missing argument 2 error when I try to put them together, but then I do not know much about PHP programming.
Thanks for considering this. I do like this module because it is so light-weight and doesn't involve a lot of heavy permissions and code.
Comment #24
retorque commentedThe patch in #20 seems to work, but it overrides TAC-lite. We use TAC-lite to allow users to edit content for their departments and prevent them from editing content for other departments.
Comment #25
retorque commentedAs a workaround for the patch in #20 overriding TAC-lite, I am currently setting node->status = 1 and executing $old_access_callback(), then setting it back to 0. I'm not convinced that workaround would be the appropriate permanent solution, but it solves my immediate problem.
I can probably figure out how to provide a patch if anyone wants to see it, but I would prefer not to provide one knowing that it's really a workaround, not a proper solution.
Comment #26
nancydruPerhaps a setting to determine whether or not allow the edit permissions.
Comment #27
retorque commentedI could probably put something like that in place in the next week or so assuming I don't end up spending all of my spare time fighting fires. Should I make this a separate issue?
Comment #28
retorque commentedI'm still not certain I like the process of setting node status to published and back to unpublished to check the old access callback, but this seems to do the job and includes a setting to allow the admin to choose whether to override or apply the pre-existing access callback.
This is my first patch, so hopefully I followed the instructions properly.
Comment #29
nancydruThat looks unnecessarily convoluted. Don't you just want to not have the "edit" permissions for your site?
Comment #30
retorque commentedWhat I was looking for is for the edit permissions to only apply if the user would have been able to edit the node if it had been published. Without this change in our environment - using TAC Lite for departmental edit permissions - any user with edit unpublished permission can edit any unpublished node, not just the unpublished nodes in his or her department.
I agree that this is a bit of a convoluted method of getting that result, and I would very much prefer to see a simpler solution, but I don't have a simpler solution myself.
I did attempt to just set the node to published without setting it back, but the array seems to be passed by reference. Unfortunately my knowledge of the access control systems beyond hook_perm() and user_access() is a bit limited.
Comment #31
nancydruYou may be looking for http://api.drupal.org/api/function/node_access/6.
Comment #32
retorque commentedFor my installation, $old_access_callback() is a reference to node_access(). I ran dpm($old_access_callback); to confirm.
The node_access() function does not explicitly take a reference to $node, but it is passing by reference for me. That may be due to PHP configuration, but if it passes by reference for me, I can't assume it will pass by value for others.
Comment #33
a8w4@geerlingguy in #21: This is very interesting! Could you please specify which OG Role module you're referring to (there are some)?
Comment #34
entendu commentedI don't seem to have this problem anymore with the new access callback.
Comment #35
bsandor commentedI made this issue active as I was working on applying #20 to view unpublished 6.1.2 without any success.
function view_unpublished_menu_alter &
function _view_unpublished_node_access
seam to be the problematic parts.
Or I missed something? Is it necessary to set module weight? My understanding is it's not necessary.
This is my code that gives 'recoverable fatal error: Object of class stdClass could not be converted to string' to the line ' if (user_access("$op all unpublished content") || user_access("$op unpublished $node->type content")) {'
How can I apply #20 to view unpublished 6.1.2?
Comment #36
entendu commented@bsandor, I just released 6.x-1.3 of this module. Please install the update, it should work fine for you.
Comment #37
bsandor commentedHi @entendu,
Frist of all: thanks for your very quick answer.
Am I missing something? There's no edit access defined in this module. I also need edit access.
My environment is an OG + OG Group Post.
I set up Workflow Fields Module. I set permissions with it for each workflow states.
What I see is: it's working fine in any other states except when my nodes are in Suggested state (nodes are unpublished here).
Also the Group admin gets the editing option. This is great.
I cant see any editing option for any group members. Not even for the node author.
When my Group Admin edits a node that a group member created it gets no longer accessable. Not for edit or view.
Also my impression is that editing and viewing permissions should be separate on Permissons settings.
Thanks in Advance. And thanks for this great module.
Comment #38
bsandor commentedIt doesn't work for me.
See previous post.
Comment #39
entendu commented@bsandor, core provides the edit permissions, take a look under the "node" sections of the permissions screen. If you grant edit & view unpublished permissions, you will be able to edit an unpublished node.
Comment #40
bsandor commented@entendu,
I don't have any 'edit unpublished' permissions at all, should I. No permission like this on whole permissions page.
Also I don't have Uninstall for View Unpublished Module. I guess it stores some info in the DB.
What is the way for me to delete them? As it might cause this problem for me if I should see 'edit unpublished permissions'...?
I installed patch #20 which might cause this for me. And then installed v1.3 which has no update if i am right.
Also My module weight was 0. I manually changed it to 1. ( as it should be if I'm right).
My install is nice and working fine so I presume something went wrong with this module somehow.
It might just not respect 'OG Roles' OR 'Workflow Fields' Modules? D6 permissions: big mistery.
Thanks in advance.
Comment #41
entendu commentedOh, are you trying to grant access to edit *only* unpublished nodes of a certain type, not *any* (published or unpublished) nodes of a certain type?
Comment #42
zoen commentedHi bsandor,
I found that with the 6.x-1.3 version, even though the edit perm *is* granted, the View and Edit tabs on the unpublished nodes don't render. I don't know why. Have you tried going to node/[nid]/edit to see if your user gets an Access Denied?
Comment #43
entendu commentedZoeN is correct.
Comment #44
hachreak commentedHi guys,
I should edit an unpublished node also if I'm not the admin and I don't have the permission "administer-nodes".
How can I do? :)
Comment #45
doublejosh commentedHaving this problem myself.This module seems to remove the permission to edit unpublished content that you don't own.
On the current dev branch for: 7.x-1.x-dev (2012-Jun-08)
Comment #46
entendu commentedDeprecating 6.x.