1

I have custom node types 'foo' or 'bar', and each node should have its own associated forum you can easily navigate to from that node. I was hoping to eventually use the rules module to generate the forum upon 'foo' or 'bar' creation.

To both 'foo' and 'bar' I've added a custom Term reference field which is validated against the Forum taxonomy, and I have not marked the custom field as required. But when trying to save any of these content types, it's making this forum reference required. Why?

Possibly related - when I add this custom field to a pre-existing content type and then view a node of that type, I get the following error:

Notice: Undefined property: stdClass::$forum_tid in forum_node_view() (line 271 of modules/forum/forum.module).

And if I try to edit, I get the following errors:

Notice: Undefined index: und in advanced_forum_type_is_in_forum() (line 1038 of sites/all/modules/advanced_forum/advanced_forum.module). Warning: Invalid argument supplied for foreach() in advanced_forum_type_is_in_forum() (line 1038 of sites/all/modules/advanced_forum/advanced_forum.module).

(Yes, I'm also using Advanced Forums, but I think this is more fundamentally a base Drupal 7 Forum module issue.)

This topic (which is marked as a duplicate of this) is as close as I could come to finding a similar error, but seems to imply that I'm trying to save a forum node (as opposed to 'foo' or 'bar') without linking it to a forum term (forum or container). Which makes some sense as when I do provide a valid value to the custom Term reference field, the 'foo' or 'bar node will show up as a thread in the associated forum and the breadcrumb on node 'foo' or 'bar' acts like a forum node breadcrumb. However, I really don't want my 'foo' node to act like a forum node.

So I'm guessing that trying to link to a forum from an arbitrary node using a Term reference custom field is a Bad Idea. How can I do this without hardcoding a URL?

1 Answer 1

0

Use entityreference. Create a rule that generates the forum on node creation and then an action that creates an entity reference in the original node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.