Create an action that changes the nodes content type when checkbox is checked when submitting

tuti - September 16, 2007 - 20:04
Project:Nodetype
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I'd like to create an action that changes a nodes content type to a blog post.

How would I go about making it convert a node to a certain content type when a a cck(or other type of) checkbox is checked when submitting a node.

Even though the nodetypemodule is installed I don't get "Change nodes content type" as an option in the actions configuration.

#1

drowlflood - September 29, 2007 - 09:10
Status:active» needs review

Here's some quick code that seems to do the trick. Just copy and paste the attached function to the end of your nodetype.module (not a patch file).

No checks are performed to see that field data will map correctly across node types, so use at your own risk. Generally, though, if the resulting node type contains each of the original node's fields it should work.

AttachmentSize
action_nodetype.txt 1.38 KB
 
 

Drupal is a registered trademark of Dries Buytaert.