Node gets written on save rather than rendered on view
tmallen - March 27, 2009 - 05:29
| Project: | InsertNode |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
If you replace the hook_filter call in this module with a hook_nodeapi that works the same as the $op = 'process' in InsertNode_filter (calling the same replacer function) the node gets updated instantly rather than being saved with the node content. I think that this is the desired behavior for the majority of this module's users, would you consider using this "live" implementation?

#1
tmallen,
If I understand what you are saying, the node module would then save the resulting node after it replaced the node tag. In other words, next time I edit, I do not see the tag anymore, just the content of that other node.
This is absolutely not the behavior I need. To the contrary. Because then changing the source node (the one defined in the tag) would have no effect on the node including that tag.
The way I use it with my customers goes like this:
1. Create a very complex page that if they edit it, it breaks, each time.
2. Put a [node:...] tag in there for the content they are supposed to edit.
3. Teach them how to edit that other node (which can otherwise be hidden from the normal users.)
Now, there may be cache problems with version 5. I had to add a case to prevent the cache from saving nodes that include the node filter.
Thank you.
Alexis Wilke
#2
That's not what I'm saying. My modification (which I'm using in a custom module currently) is an exact replica of this module with one difference: The preg_replace_callback call occurs in hook_nodeapi instead of hook_filter($op = 'process') so the node that gets filled in is always current. hook_nodeapi, when operating on the 'view' case, cannot alter stored node content, only transform it for the view.
Maybe this is how the module is supposed to work, but I'm certain that it does not work this way in 5.x unless you use hook_nodeapi.
#3
Hi tmallen,
I do not think that version 5 is being maintained much anyway... So your fix should last for a while.
I'm only working on v6 and there was a problem in the hook_filter(). More or less, the cache was turned ON and the changes would indeed not appear. By adding a case in the function, I fixed the problem:
<?phpcase 'no cache':
return TRUE;
?>
Thank you.
Alexis Wilke