Hey, guys

I have a question about content saving.
I have a content type named 'aaa', and i want to do some updating during/after its creation, how can i do that,
should i implement certain hook or ...

I only want this content type's content do some updating, not other content types

Any suggestion appreciated!

Comments

jamestombs’s picture

Use hook_nodeapi.

Then use:

if ($node->type == 'aaa' && $op == 'insert') {
  // CREATION ACTIONS
}
if ($node->type == 'aaa' && $op == 'update') {
  // UPDATE ACTIONS
}
if ($node->type == 'aaa' && $op == 'presave') {
  // UPDATE $node BEFORE SAVING TO DATABASE (UPDATE OR NEW)
}

James T
Action Medical Research - www.action.org.uk

liaolliso’s picture

really thanks for the quick reply. i will do that