I've modified the view_unpublished.module (http://www.drupal.org/project/view_unpublished) to allow me to allow specific user roles to edit unpublished nodes *without* giving them the "administer nodes" permisson. http://drupal.org/node/300967
This works because I've create a menu task that calls 'node_page_edit' under the correct circumstances (user has correct role to edit unpublished nodes).
All is well until a user edits a node that he did not author. When he clicks on "Submit", he is returned to the site main menu instead of the view of the edited node.
My question is: How can I correct this?
I recognize that the problem is because once the node is submitted, the core system determines that the user does not have access to the node because it's unpublished. What I need to know is what hook should I use to tell the system to take this user to the node view instead of the main site page.
Thanks for any help!
Comments
hook_nodeapi('update')
This appears to solve my problem:
I just don't know if there are any unintended consequences to using drupal_goto in hook_nodeapi('update'). In doing so, might I prevent something else from happening that should be happening? For one thing, I noticed that I don't see "Event updated" at top of screen as I did before. Does this mean something is being skipped?
Nope, this won't work
The 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').
If you call drupal_goto()
If you call drupal_goto() during hook_nodeapi($op='update'), and your module weight is really low, this will PREVENT all other modules from processing the $op=update. This can break lots of things, especially where nodes are augmented or logged by other modules.