Walk you through what happened:

1. Clean HEAD install, enabled Forum module.
2. Went to create a Forum topic, it let me enter all the node details and I pressed save but since I didn't have any 'forums' or forum containers, it wouldn't let me save the Forum topic.

WTF... Can we maybe add a default Forum called 'General discussion' much like we created a default site-wide contact category? Or at least not allow forum topics to be created until a forum or forum container is created?

3. Once I created my forum and a new forum topic node, I noticed comments were disabled.

WTF... Can Forum module possibly enable comments for forum topic nodes by default? I have a feeling lots of people will have to go back just as I did and enable comments on each node until they figure out they have to change the content type's settings.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heather’s picture

I agree, Configuring the forum module could be made easier by having a default 'General Discussion' forum created to start.

We should make them easier to use; especially by configuring common settings by default.

I also think it's confusing you can add a forum topic, when no forum exists. See related issue: #221527: Don't show Create Forum topic (node/add/forum) when there isn't a forum

However, I didn't see your number 3: that comments were disabled by default?
Do you mean that permissions don't allow forum creation by authenticated users by default? That probably won't be changed.

Not sure I understand 3.

heather’s picture

Issue tags: +Usability

Add usability tag so other Usability team people can find this.

JuliaKM’s picture

I just tested this out on a fresh install and was able to replicate #2. After enabling forum and attempting to add a new forum post, I received the validation error message that "Forums field is required."

Next, I added a term to my Forums vocabulary and was able to post without an error message.

After this, I tried to reproduce the error message "Forums field is required" by deleting the term I had added to my Forums vocabulary. However, when I clicked "edit" under Operations (screenshot attached), I am sent to the page listing all content tagged with that term. There doesn't appear to be any way to delete the forum taxonomy terms after you add them.

Finally, in reference to #3, my first forum topic had comments automatically enabled.

Bojhan’s picture

Sure, patch please.

DamienMcKenna’s picture

A related issue, but it'd be really great if there was a system-wide setting to control whether modules were expected to create sample data when installed so that beginners had less of an "ok, now what" reaction upon installing something? This could be used to decide whether a single "General Chat" forum was added, maybe even an initial topic & comment?

Dave Reid’s picture

Assigned: Unassigned » Dave Reid
joachim’s picture

Assigned: Dave Reid » Unassigned

A dsm() on install with a link to the forum creation admin would be a partway solution. Or if we create a single term to start the user off, tell them about that, eg 'An initial forum board has been created for you. Customize the boards on the [link]admin page'.

Dave Reid’s picture

Assigned: Unassigned » Dave Reid
Status: Active » Needs review
FileSize
4.01 KB

Initial work to provide a 'General discussion' forum on first install/enable. Haven't touched tests yet so we'll so how it does.

marcingy’s picture

From a functional point of view this seems to work just fine and it makes complete sense from a usability point of view.

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

As the bot likes it mark RTBC

Bojhan’s picture

Sensible defaults, this is a good improvement.

Dries’s picture

Status: Reviewed & tested by the community » Needs work
+++ modules/forum/forum.module	3 Jan 2010 22:22:27 -0000
@@ -281,12 +281,17 @@ function forum_node_validate($node, $for
+        if (!$term) {
+          form_set_error('taxonomy_forums', t('You must select a forum.'));
+        }

Why was this added? Also, it seems to be the only error message starting with 'You'.

Dave Reid’s picture

We needed to add that validation because the forum module makes it's 'Forum selector' taxonomy term option required, but fieldapi doesn't validate when the user selects '- None -', so we have to do it manually. I'll re-roll without the 'You'.

sun.core’s picture

+++ modules/forum/forum.admin.inc	3 Jan 2010 22:22:27 -0000
@@ -243,10 +243,12 @@ function forum_overview($form, &$form_st
-        $form[$key]['edit']['#markup'] = l(t('edit container'), 'admin/structure/forum/edit/container/' . $term['tid']);
+        $form[$key]['edit']['#title'] = t('edit container');
+        $form[$key]['edit']['#href'] = 'admin/structure/forum/edit/container/' . $term['tid'];
...
-        $form[$key]['edit']['#markup'] = l(t('edit forum'), 'admin/structure/forum/edit/forum/' . $term['tid']);
+        $form[$key]['edit']['#title'] = t('edit forum');
+        $form[$key]['edit']['#href'] = 'admin/structure/forum/edit/forum/' . $term['tid'];

Cause for the re-roll, probably.

+++ modules/forum/forum.install	3 Jan 2010 22:22:27 -0000
@@ -56,6 +59,16 @@ function forum_enable() {
+    // Create a default forum so forum posts can be created.
+    $edit = array(
+      'name' => t('General discussion'),
+      'description' => '',
+      'parent' => array(0),
+      'vid' => $vocabulary->vid,
+    );
+    $term = (object) $edit;
+    taxonomy_term_save($term);

This belongs into hook_install(), not _enable().

6 days to code freeze. Better review yourself.

sun.core’s picture

Priority: Critical » Normal

But, yeah, this would be nice, but not strictly critical.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
2.12 KB

Forum does all its taxonomy term setup in enable so I don't think that the Taxonomy term setup belongs in install. Re-rolled for HEAD.

Dave Reid’s picture

Note test bot is having problems reporting back on patch status, but #16 passed: http://qa.drupal.org/pifr/test/26664

yoroy’s picture

FileSize
2.11 KB

'You must' is a copy writing no-go, so changing
"+ form_set_error('taxonomy_forums', t('You must select a forum.'));

to

+ form_set_error('taxonomy_forums', t('Select a forum.'));

(don't tell me what I should do, just tell me what needs doing)

yoroy’s picture

#18 passes too.

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community

Yep, looks good.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Sorry, but I'm going to have to -1 creating sample content in hook_enable(). That's what install profiles are for, since it's safe to make assumptions about said content there, but not at the module level. It's too bad our core forum module is not up to snuff enough to enable it in default.profile, but maybe we can try and organize some effort around this in Drupal 8.

I also don't see anything in the patch that enables comments by default on forums, even though that's in the original bug report. Additionally, it smells like we could use some test coverage here.

Dave Reid’s picture

Yes that's a valid reason for modules required by the default install profile, but for other modules we've already started doing this: #597540: Create a default contact category on install. The module is just not usable and causes weird errors for users without a default container.

Dave Reid’s picture

And ++1000 to having standard_modules_installed() implemented in the default profile for standardizing adding test data in D8.

joachim’s picture

forum_enable() already creates a vocabulary for the forum, so I don't see that also creating a term makes it worse.

webchick’s picture

Ugh. I didn't see that other patch go in. I guess there's precedence for this then, sadly... :(

I do fundamentally believe that modules are *functional* pieces and should not make assumptions about how they will be used in the field. The creation of the vocabulary is something that is functionally required for this module to actually work, the creation of terms is not. It also makes assumptions that they will not want to group their forums under categories, etc. etc. Ick.

But sigh. I guess it's no worse than what Contact module does now. Still needs tests, though.

joachim’s picture

> Ugh. I didn't see that other patch go in. I guess there's precedence for this then, sadly... :(

LOL... I'm pretty sure that's been in since 4.7 or earlier -- image_galleries module cribs it for its own vocab!

> the creation of terms is not.

Hmm... I think it would be enough to have a drupal_set_message on installation that says 'Now go and create some forum topics!'.

rgristroph’s picture

Here is a patch that includes that from #18 above and also adds a test to the forum.test file which tests for the creation of the default forum. It works for me.

naxoc’s picture

Status: Needs work » Needs review

Setting status for the testbot to have a go at the patch

Status: Needs review » Needs work

The last submitted patch, forumimprovements-with-test.patch, failed testing.

Kevin Hankens’s picture

The .install file patch above causes an exception to get thrown because of a duplicate key error.

Steps to replicate:
1. apply the patch
2. enable the module
3. disable/uninstall the module
4. re-enable the module.

This patch catches that exception with a message that the vocabulary already exists.

NOTE: the simpletest patch in #27 is not included here.

dwightaspinwall’s picture

Test fails (test #27)

Damien Tournoud’s picture

We needed to add that validation because the forum module makes it's 'Forum selector' taxonomy term option required, but fieldapi doesn't validate when the user selects '- None -', so we have to do it manually. I'll re-roll without the 'You'.

What?

pcarman’s picture

Status: Needs work » Needs review
FileSize
1.99 KB

This patch only updates the forum.test. The patch includes the additional tests written in comment #27 without the changes to other forum files.

Since the addition of the default forum vocabulary, the orphan test was failing. The test has been updated to validate the testing for orphan items.

This patch works with the patch from comment #30.

Kevin Hankens’s picture

Ok, here's a simpler version of #30. The variable "forum_nav_vocabulary" was being deleted as part os #27. #30 handled an exception that was thrown as a result. After talking with Dave Reid briefly, it made more sense to just /not/ delete the variable :)

So, the current status of this issue is:
Patch from comment #33 adds tests
Patch from this comment fixes handling of default vocabulary and avoids errors in hook_uninstall.

rgristroph’s picture

Status: Needs review » Needs work

It seems to me that the patch in #30 is on the right track, but instead of just catching the exception and putting out an error, maybe it should at least check the exception for that one case and only handle it there if it is the exception we expect ?

Probably better would be to check for the vocabulary existing, and not create it if it is there.

The patch in #34 I am not sure of, on one hand it seems better to delete the variable behind us to clean up, on the other hand we are not deleting the Forum vocabulary itself, it would seem like a bad idea to do delete the vocabulary, and leaving behind the variable as a descriptor of what it is seems OK. I think on the balance it is the smartest thing to do.

Kevin Hankens’s picture

Status: Needs work » Needs review
FileSize
3.83 KB

Conferring with pcarman we decided to roll the test patch in with the default vocabulary patch as the automated testing was failing.

Here it is in one bundle

Kevin Hankens’s picture

Here's a slightly revised version with proper comment formatting.

fending’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed in context of #30+, RTBC. Looks great, works well; thanks for fixing up those comments in *.test.

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs work
+++ modules/forum/forum.test	22 Apr 2010 20:01:30 -0000
@@ -35,6 +35,9 @@
+    // Test that the forum install created a default forum.
+    $this->doInstallTests();

See below.

+++ modules/forum/forum.test	22 Apr 2010 20:01:30 -0000
@@ -94,11 +97,34 @@
+    // Reset the defaults for future tests.
+    module_enable(array('forum'));

I don't think this is necessary for the tests to pass. The module list should be refreshed between every test case.

+++ modules/forum/forum.test	22 Apr 2010 20:01:30 -0000
@@ -94,11 +97,34 @@
+  private function doInstallTests() {
+    // Load the /forum url.
+    $this->drupalGet("/forum");
+
+    // Look for the "General discussion" default forum.
+    $this->assertText(t("General discussion"), "Found the default forum at the /forum listing");

Are we re-using this function anywhere else? If not, let's just put this into testForum().

Powered by Dreditor.

Kevin Hankens’s picture

Status: Needs work » Needs review
FileSize
3.74 KB

Great, here's the revised patch that addresses those concerns.

rgristroph’s picture

Status: Needs review » Needs work

I can confirm that the patch in #40 passes all the forum tests and works, I also red through it and all makes sense.

heather’s picture

Status: Needs work » Reviewed & tested by the community

Heya @rgristroph do you mean RTBC?

By your comments it seems so.

rgristroph’s picture

Yes, I think this is RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kenorb’s picture

Any solution/backport for 6.x?