my problem is : I have a content type called job posting, every job post will associated with a test set that every candidate should write to get qualified for that job i.e., when I create a node of job posting content type another node of type test has to be automatically created.

what is the best approach towards it. It thought to try actions, but it is won't help me in any way. could any body suggest me a way to do it.

  • 2
    If you don't afraid of programming way you can use hook_node_insert to create second node. Check rest of Node API too.
    – Codium
    Nov 21, 2013 at 11:41
  • Hello. Asking for best approach is a bit iffy here - we don't really want pools. And are you looking for a code solution? Or as simple to set up thing as possible? In the latter case, Rules might help (maybe, never had use case like yours).
    – Mołot
    Nov 21, 2013 at 12:13

1 Answer 1


As said by @drupality

function hook_node_insert($node) {
 if ($node->type != 'job_posting') {
$node = new stdClass(); // Create a new node object
$node->type = "test";
node_object_prepare($node); // Set some default values

$node->title    = "YOUR title";
$node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled

$node->uid = 1; // UID of the author of the node; or use $node->name

.//Enter your other field values

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.