Examine the following trivial code:
$node = node_load(123);
node_save($node);
This code will cause bookmarks of "Show on Form" type to get deleted. That's because views_bookmark_nodeapi('update') assumes the $node->views_bookmark checkboxes array is always present. But this array is present only when the node is saved through a form, not when a node is saved directly via node_save(). Note that the Actions module saves node via node_save(), which means that our module isn't compatible with it.
I'm attaching a patch.
The fix could be simply to do if (!isset($node->views_bookmark)) { return; } in views_bookmark_nodeapi(). However, I prefered to revamp the code there. No need for all the current logic, becuase it's done in hook_form_alter() already. FAPI takes care of security for us.
| Comment | File | Size | Author |
|---|---|---|---|
| vbm_nodeapi.diff | 1.23 KB | mooffie |
Comments
Comment #1
quicksketchThis sounds great to me. I tested it out and couldn't find any problems. I love the simplification of the logic. Applied to 5.x. Great catch and a big thank you!
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.