Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
forum.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2012 at 02:21 UTC
Updated:
30 Aug 2022 at 12:53 UTC
Jump to comment: Most recent
Comments
Comment #1
cimo75 commentedHi
in forum.module line 626 I changed it to default to FALSE as a temporary solution
$form['taxonomy_forums'][$langcode]['#required'] = FALSE;Comment #2
larowlanHi
For a more permanent solution, you can implement hook_form_alter in a custom module to set this.
Marking as works as designed as this is a specific use case, the generic use case is for forum-node-types to require the taxonomy.
Lee
Comment #3
cimo75 commentedHi larowlan
thank you for the code.
I still think the issue I pointed to is an area that just be revised, firstly, as i pointed out I can see many occasions where a content type may have just some nodes marked as forum topics, secondly because there is an inconsistency in the fact that even if I mark the taxonomy as not required for a given content type, this behavior is not reflected on the node add form, this is still an issue GUI wise and can be confusing.
Simone
Comment #4
derekwebb1 commentedI added this:
$form['taxonomy_forums']['und']['#required'] = FALSE;
to a module as described above and that doesn't actually work.
Also, changing the weights of the module that I added that to does not help either.
The UI is likewise unable to override the line 625 in forum.module that sets this requirement to TRUE.
At this time the only way I have found to correct this is to hack the module as in #1.
EDIT: I also added this in both hook_form_alter and hook_form_FORM_ID_alter and though the code inside these functions is executed as expected, the requirement stays the same until you comment out line 625 where the reuirement is set to TRUE...
One More EDIT: We only have the forum content type on this system so I doubt it has to do with the content types that you use the field on.
Comment #5
cimo75 commentedLatest version and the bug (or inconsistency) is still present.
S.
Comment #6
cimo75 commentedrebump
Comment #7
darrylseto commentedSorry to nag but the only way I could fix this for one of my sites was to change the core forum.module.
Comment #8
darrylseto commentedStill nagging. No longer sorry to do so. This bug has been around for two years now and it forces me to change a core module every time Drupal core changes.
Note that it is a bug as field settings are automatically over-written.
Comment #9
darrylseto commentedComment #10
darrylseto commentedComment #11
darrylseto commentedI was able to make the module work by changing weights as per https://www.drupal.org/node/110238 where the '[the_other_module_name]' is 'forum'.
To keep this field required for Forums I used hook_form_alter() to set $form['taxonomy_forums'][$langcode]['#required'] to FALSE if $form_id != 'forum_node_form'.
Still does not solve GUI issue!
Comment #13
poker10 commentedThe form_alter approach works, but you need to play a bit with the module weights or use the
hook_module_implements_alter(), see: https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_module_implements_alter/7.xHowever if you set the field as not required, then you can get this warning: #1621334: Notice: Undefined property: stdClass::$forum_tid in forum_node_view() .