Thanks so much for this module. It works very well and we appreciate your efforts on the community's behalf.

We run Web sites for schools and for students. We focus on writing and helping students become better at it. We are a nonprofit.

We have a need for a feature that would allow users to clone their node and turn it into a different content type. For instance, turn a blog into a draft or a final entry for consideration for publication.

Is there a patch out there that will work? Does anyone else have this need? Can anyone help?

Thanks so much

geoff gevalt
youngwritersproject.org

Comments

pwolanin’s picture

This sounds pretty site-specific since it might fail if the fields of the node types don't match.

There is a hook in the module that you could use to pretty trivially make this happen with your own site-specific custom module.

ggevalt’s picture

Thanks for the suggestion. Can you be a bit more specific regarding the hook?

And, yes, the fields will be the same.... The reason we want to do this is to have students see the progression of their work from idea>>draft>>finished work>>multimedia

any more suggestions out there?

g

pwolanin’s picture

Status: Active » Fixed
      // Let other modules do special fixing up.
      // The function signature is: hook_clone_node_alter(&$node, $original_node, $method)
      // Where $method is either 'prepopulate' or 'save-edit'.

Status: Fixed » Closed (fixed)

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

eL’s picture

ggevalt - have you succes? I would like to know more about it, because I´d like to implement same functionality. Cloned node should be another content type, because I´d like to allow users only clone original, but not to allow to create this original content type.

WorldFallz’s picture

just an fyi for anyone else stumbling across this thread, you can do this with the following:

function mymodule_clone_node_alter($node, $original_node, $method) {
  $node->type = 'new_content_type';
}

Had to change &$node to $node due to the 'call time pass by reference' deprecation, but it doesn't seem to have adversely affected anything (afaik, $node is already a reference).

You can also do field mapping in the hook if you have certain fields in $original_node that are not named exactly the same in the new content type.