By acomer on
I need to post-process a disknode after it has been added. I attempted hook_nodeapi in my module but it seems that the file has not yet been processed by the disknode hook_nodeapi. Since the disknode.module populates the $node with info such as mimetype, filesize, etc I must wait until after it completes its processing. I tried modifying the module weight but that did not seem to help.
Comments
Please!
I have a similar problem, and a solution would be greatly appreciated. Hook_nodeapi lets me catch when a user changes/adds a node, but that fires *before* the node itself is updated or added; it's useless since I need access to the node's body *after* the changes have been saved. Is there a way, from within my module and fired by user actions, to look at a node after it's been handled?
FYI I solved this problem by
FYI I solved this problem by using hook_nodeapi on $op='submit' and setting the weight of my module in the system table to a higher number than the module that inserts the node.
Didn't work for me
That makes sense, even if it's a slight abuse of hook_nodeapi, but it didn't work. Is there a reset of some sort to get Drupal to recognize the new module weights? I re-submitted the settings and module pages in admin, no change. I disabled and re-enabled my custom module, still no change.
not sure why.
I'm curious why you think this is an "abuse" of hook_nodeapi, given I saw no other way to achieve this short of hacking the disknode module. Anyway, I believe the modules are invoked in the order they exist as returned from module_list..."SELECT * FROM system ...ORDER BY weight" or something like that (see http://api.drupal.org/api/4.7/function/module_list) , so I would expect it to work. I did notice though that there is a problem with the implementation of the mimetype function in PHP on the Windows platform so I was never seeing that field updated even in my hook_nodeapi implementation
To track this one down I inserted calls to watchdog at strategic locations inside disknode.inc and in my implementation of hook_nodeapi to determined the order these things were invoked.