Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using advanced_forum, tagging polls as forum content, this error fires up.
Patch attached.
Related issue in advanced_forum #1621218: Facultative forum definition for other types (scenario explained further there);
Opening this new issue even if #690328: Notice: Undefined property: stdClass::$forum_tid in forum_node_view() exists, because many days have past since.
Comments
Comment #1
SebCorbin CreditAttribution: SebCorbin commentedOops, patch was empty
Comment #2
SebCorbin CreditAttribution: SebCorbin commentedMissing parenthesis
Comment #3
larowlanThis needs to be fixed in 8.x first, then backported.
Comment #4
larowlantagging
Comment #5
larowlanNo way we can test this, with clean install of D8 even following steps at #1621218: Facultative forum definition for other types there is no way to create a poll node without nominating the forum term.
This must be a legacy content issue, where poll content exists before forum taxonomy field is added to poll content type.
Happy to patch for cleaner code, but no need for tests.
Re-rolled as 8.x patch
Comment #6
swentel CreditAttribution: swentel commentedRerolled
Comment #7
swentel CreditAttribution: swentel commentedrelated to #1408260: Core Forum Undefined Variable, Undefined Property ?
Comment #8
SebCorbin CreditAttribution: SebCorbin commentedPatch is still good for me
Comment #9
webchickSomething should be catching this in the tests...
Comment #10
YesCT CreditAttribution: YesCT commented@webchick in #5 it was detailed why cannot test for this.
Does anyone have more information to add that will show how this can be tested?
Comment #11
szt CreditAttribution: szt commentedBackported to D7.
Comment #12
szt CreditAttribution: szt commentedjust see it was already backported in #2, eh :)
Comment #13
szt CreditAttribution: szt commentedComment #14
szt CreditAttribution: szt commentedComment #15
jmarkel CreditAttribution: jmarkel as a volunteer commentedI am removing the Novice tag from this issue because the existing patch no longer applies - underlying code has changed to the point that forum_node_view() no longer exists. It's not clear that this bug even still exists in D8 - it may now be only a D7 issue.
I’m using this documentation as a source: https://www.drupal.org/core-mentoring/novice-tasks#avoid
Comment #19
salvisI see this issue
independent of poll and advanced_forum, only by adding an optional taxonomy_forums term reference to a content type other than forum and leaving the reference empty.
_forum_node_check_node_type($node) will then categorize those nodes as potential forum nodes (which is intended), but this causes core to call forum_node_view($node, $view_mode), even if $node->taxonomy_forums is empty and $node->forum_tid not set, which causes this notice.
Reroll #2 for D7 and...
... swap the conditions.
Comment #22
introfini CreditAttribution: introfini commentedThe patch at #19 fixes those errors for my Drupal 7 installation. Thanks.
Comment #23
salvisDo you by any chance have Forum Access installed?
I found out only a few days ago that this was caused on my D7 site by my use of FA for non-forum nodes, and I just posted a patch that solves the issue in this case: #2958547: Support non-forum nodes with optional forum_taxonomy field
Comment #28
ivnish CreditAttribution: ivnish commented#19 patch works. Please commit
Comment #29
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedThanks, patch #19 works and fixes the problem mentioned here! As it can be simulated also without advanced_forum and poll modules, I have created a test for this specific case in the forum tests, so we would have this covered.
Reuploading the patch #19 (unchanged) with additional test added and test only version.
Comment #31
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedAdding a tag for other maintainer review.
Comment #33
mcdruidThanks for adding the tests, and thanks everybody that contributed!