Currently, when you clone a Quiz node using the node_clone module (http://drupal.org/project/node_clone) it correctly clones the node, but it loses all of the associated questions. This is far from ideal because the questions are one of the primary aspects of a quiz, and thus it would be expected for the question association to be maintained when cloning a quiz.

I have attached a patch that adds support for transferring the question relationship to the cloned node when saving. In order to test this patch you will need to install the node_clone module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

btopro’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that this provides node clone support for quiz module. this would be a very helpful patch when managing lots of quiz objects over time instead of rebuilding similar quizzes all the time.

akeemw’s picture

I found that I needed to have a small change in this patch for it to work.

I'm re-uploading the same patch with one change, adding a reset flag on the node_load. For some reason it would only return false for me withing the quiz_insert function.

$old_quiz = node_load($node->clone_from_original_nid, NULL, TRUE);
akeemw’s picture

Issue summary: View changes

Fix typo

t0xicCode’s picture

This should also be ported to 7.x-5.x. But in the meantime, the attached patch removes the added whitespace.

falcon’s picture

Status: Reviewed & tested by the community » Needs work

Was unable to apply the patch successfully, this seems to be fixed already?

qsiraut’s picture

Hello,

When I have a quizz that uses random categorized questions, cloning does not keep the defined categories and related number of questions.

Thanks

t0xicCode’s picture

Status: Needs work » Fixed

Seems like @falcon is correct and it's already fixed.

@qsiraut, that seems like a separate issue. Would you mind creating a new issue?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.