By half_brick on
I've developed several new modules and node types for a site I'm doing, for one of these node types, after I create a new one with the submit form I want to redirect to another page.
I've been doing this with drupal_goto at the end of the hook_insert and I also tried hook_nodeapi but the issue is that it kicks in before the image attach module has had it's hook_nodeapi called.
I seem to recall reading somewhere that I need to wieght the image attach module with a smaller number than my custom module, but I've tried several things and nothing seems to work.
Any help would be appreciated.
Cheers
Comments
I don't know exactly what
I don't know exactly what you have tried, but you can try this...
There is a moduleweights module here http://drupal.org/project/moduleweight that will allow you to play around with the weights of the modules. I wouldn't play with the weight of any other module but your own since they may be set at a specific weight in order to properly work with other modules and you can't expect any users using your module (if you were to make it public) to alter weights like this anyway. I haven't tried this module btw but assume it works.
Once you have found the appropriate weight for your module you need to write a '.install' file that sets this weight explicitly - something like
Change '10' to be whatever you want. 10 is last in the call list, -10 is first. Name this file 'yourmodulename.install' and include it in the yourmodulename directory with yourmodulename.module.
If your module is already installed, the install file might not run, even if you uncheck and recheck the module name on the administrator page. It may only run on first install. In this case call the function 'yourmodulename_update_1()' and run 'update.php' from the module install page.
Hope that helps.
Thanks for that. I had tried
Thanks for that.
I had tried modifying module weights in the system table. It works, in that the hooks get called in the order you expect.
But my new issue is with the fact that the nodeapi hook gets called multiple times and after the first call for each module, the calls don't seem to be as predictable.
Basically I just need to redirect after form submission, and so need to know which hook I can bang a dupal_goto into so that it gets called last and doesn't interfere with other modules.
Cheers
hook_form_alter
You can probably use hook_form_alter to set an explicit #redirect.
--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.