Is there an example of module that creates/deletes other nodes?
I have a custom module that in some circumstances it would be handy if it could create 2 or 3 other (largely boilerplate) nodes in certain circumstances, and in others if it could delete 1 or 2 other nodes. Are there examples of similar things I can study?
On Sun, 7 Aug 2005, Jim Tittsler wrote:
Is there an example of module that creates/deletes other nodes?
I have a custom module that in some circumstances it would be handy if it could create 2 or 3 other (largely boilerplate) nodes in certain circumstances, and in others if it could delete 1 or 2 other nodes. Are there examples of similar things I can study?
node_delete(array('nid' => $nid, 'confirm' => 1));
is what you want.
Cheers, Gerhard
On Aug 7, 2005, at 20:28, Gerhard Killesreiter wrote:
On Sun, 7 Aug 2005, Jim Tittsler wrote:
Is there an example of module that creates/deletes other nodes?
I have a custom module that in some circumstances it would be handy if it could create 2 or 3 other (largely boilerplate) nodes in certain circumstances, and in others if it could delete 1 or 2 other nodes. Are there examples of similar things I can study?
node_delete(array('nid' => $nid, 'confirm' => 1));is what you want.
Thanks! That does appear to solve the delete problem.
What is the sequence of steps that my custom node module can perform to create nodes of another type (controlled by a different module)? I would like my custom module to cause 3 other "page" nodes to spring into existence (with body text that is programmatically generated) when my custom node is created.
On Mon, 8 Aug 2005, Jim Tittsler wrote:
On Aug 7, 2005, at 20:28, Gerhard Killesreiter wrote:
On Sun, 7 Aug 2005, Jim Tittsler wrote:
Is there an example of module that creates/deletes other nodes?
I have a custom module that in some circumstances it would be handy if it could create 2 or 3 other (largely boilerplate) nodes in certain circumstances, and in others if it could delete 1 or 2 other nodes. Are there examples of similar things I can study?
node_delete(array('nid' => $nid, 'confirm' => 1));is what you want.
Thanks! That does appear to solve the delete problem.
What is the sequence of steps that my custom node module can perform to create nodes of another type (controlled by a different module)?
Sure, just construct appropriate objects and pass them to node_save.
I would like my custom module to cause 3 other "page" nodes to spring into existence (with body text that is programmatically generated) when my custom node is created.
I'd sure like to see that in action. :)
Cheers, Gerhard
On Tue, Aug 09, 2005 at 09:23:43AM +0100, vlado wrote:
Sure, just construct appropriate objects and pass them to node_save.
Have a look at node_aggreagtor for examples.
Thanks for the pointer! That does look very helpful.
I'd sure like to see that in action. :)
Me too
Not nearly as much as I would. :-/
Jim
Jim Tittsler wrote:
On Tue, Aug 09, 2005 at 09:23:43AM +0100, vlado wrote:
Sure, just construct appropriate objects and pass them to node_save.
Have a look at node_aggreagtor for examples.
I had a start on this functionality in the mime_registry module. It hasn't been updated since Drupal 4.5, but I will say from personal experience that simple node types are relatively easy to create. When you have files, images, etc, it gets a bit more complicated.
-Mark (javanaut)