The way that Node Convert decides whether a node is going from/to a forum post is by checking whether it is of type "forum". However, any content type can be put into a forum--the determining factor is whether the forum vocabulary is applied to the type--so this behavior is not correct.

This means that if you convert a post of type "forum" to another type that has the forum vocab applied, the entries in the forum table are removed, even though they are still valid. It also means that you shouldn't be forced to choose a specific forum type to put the post in if you are going between two valid forum types (the post already has the proper forum tag).

CommentFileSizeAuthor
#1 valid-forum-types-1798116-1.patch5.63 KBkevin.dutra

Comments

kevin.dutra’s picture

Status: Active » Needs review
StatusFileSize
new5.63 KB

Here's a patch that does a couple things.

First, it makes "src_node_type" available in the $data array that gets passed to hook_node_convert_change(), since you don't have the node to work with for the "options" and "options validate" operations. It's also just handy to have.

Second, it uses checks the $data['src_node_type'] and $data['dest_node_type'] to see if they have the forum vocabulary and that makes the determination on whether to do actions within the forum implementation of the hook.

  • Rows are only inserted into the forum/term_node tables if converting from a non-forum type to a forum type. (If both are forum types, then the existing entries can just carry over.)
  • Rows are only deleted from the forum/term_node tables if converting from a forum type to a non-forum type. (Same deal here with regard to existing entries.)
  • The option to choose what forum type the node should get assigned (and it's validation) is only presented when converting from a non-forum type to a forum type. (If both are forum types, then the post already has it's forum tag assigned and it can be carried over.)