The button uses drupal_goto, which stops processing. I see that the module tries to push itself at the end of the processing queue with hook_module_implements_alter, but that's not enough apparently in Drupal 7. Even core functions are skipped, like the one that assigns default view-by-all grants for published nodes. From modules, in my setup, FileFiled Paths is also skipped.

I believe that hook_module_implements_alter should be removed and drupal_goto changed to something else, that would always run at the end of all processing. Attached is a patched that demonstrates this by replacing $_GET['destination'], which solves all of the mentioned problems. It does however have a sideeffect of losing any destination that was set before. Perhaps it is possible to generate destination with another nested destination value?

Comments

catorghans’s picture

thanks!

I think this should be in the module.

kmare’s picture

Status: Needs review » Needs work

Hello,
I tried that patch, but it didn't work for me. It actually threw me a PDO exception 23000.... there are other goto functions in the go, shouldn't they be updated too?

nicholasthompson’s picture

They should be, yes. Drupal Goto shouldn't be used to redirect form submission.

I'll see if I can get a patch for this now.

This actually breaks Node Access on our in-dev system; a node saved with "Save and Add Another" gets no entries in {node_access}.

nicholasthompson’s picture

Status: Needs work » Needs review
StatusFileSize
new3.44 KB

This patch (which can be applied using git apply to the 7.x-2.x branch) changes the system to use submit handlers on the buttons, rather than drupal_goto.

I have tested this locally and it seems to fix the issues I had.

kmare’s picture

Status: Needs review » Reviewed & tested by the community

Thank you nicholasThompson!
Your patch works great on 2 projects I'm working on, would be awesome if it could be applied upstream.

robin monks’s picture

Status: Reviewed & tested by the community » Fixed

Applied to 2.x-dev.

Thanks for your work here nicholas!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

larowlan’s picture

Issue summary: View changes

In a submit handler $form_state['redirect'] = $some_path should be enough

See eg http://cgit.drupalcode.org/commerce_node_checkout/tree/commerce_node_che...