Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link
user15837
  • 479
  • 2
  • 5
  • 16

Add multichoice question to quiz node programmatically

I'm using the latest version of drupal and quiz module. In my custom module, I have created a quiz by using below code

 $quiz = new stdClass();
  $quiz->title = 'Testing Quiz';
  $quiz->type = 'quiz';
  $quiz->language = LANGUAGE_NONE;
  $quiz->uid = 1;
  $quiz->status = 1;
  node_object_prepare($quiz);
  $quiz = node_submit($quiz);
  node_save($quiz);

However, the quiz is created successfully. I have a list of multichoice question, which is imported using feeds module. Now what I want is assign those multichoice question to this custom quiz node.

How can I do this?