I spent a bit of time analyzing the interactions between Forum and Category. Here are the remaining problems and possible solutions.
Things currently broken:
1) Removal of "critical vocabulary options"
Problem: Forum attempts to ensure its vocabulary is set up properly by modifying the vocabulary form.
Thoughts: That form isn't even provided anymore, as we have the container settings forms on container nodes.
Possible Solutions:
1.1) We could make a fake vocabulary form, module_invoke_all the form_alter hook on it, and analyze any changes. We could then use that to determine whether to hide elements on the container settings page.
Pros -- Would make managing forums less error-prone.
Cons -- High complexity.
1.2) We could just ignore this and document that you shouldn't mess around with the container settings for forums.
Pros -- Less work, code wise.
Cons -- More work, documentation and support load wise.
2) forum_validate files an error aginst the taxonomy element if a container is selected.
Problem: The taxonomy element doesn't exist.
Thoughts: This one is a difficult one...
Possible Solutions:
2.1) We could use an actual taxonomy element on the form.
Pros -- Would fix the silent failures when posting to a container.
Cons -- Would break categorizing forum topics against other containers.
2.2) We could have a forum compatibility module that handles doing this on behalf of forum
Pros -- Cleaner than doing even more form wrangling.
Cons -- More maintenance overhead.
3) forum_prepare injects a taxonomy element to set the default forum when posting based on arg(3).
Problem: We disregard the contents of $node->taxonomy.
Thoughts: It might be possible to hook op prepare late in the game and sync things up.
Possible solutions:
3.1) We could detect this and match the changes in category.
Pros -- This might help fix other modules too.
Cons -- More magic means more complexity.
3.2) See 2.2.
4) forum_link_alter looks for taxonomy_term links and changes the paths to point back to forum.
Problem: Category's links point to node/*, not taxonomy/term/*, so forum never sees them.
Thoughts: We could use "canary links" and do another link_alter pass, but is it worth it?
Possible solutions:
4.1) Create a fake set of links using the taxonomy syntax, pass it through module_invoke_all link_alter, and see what comes out.
Pros -- This might help fix other modules too.
Cons -- More magic means more complexity.
4.2) See 2.2.
Final analysis:
The "easy way out" is to just go ahead and make a small compatibility module that will do the form mangling on behalf of forum.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | forum_compat.patch | 2.43 KB | bdragon |
Comments
Comment #1
bdragon commentedI have begun working on a small compatibility module.
Comment #2
bdragon commentedHere is a module implementing workarounds for problems 2, 3, and 4.
Enabling this module and using patch http://drupal.org/node/115693#comment-192976 should fix nearly all outstanding forum problems.
This is for DRUPAL-5 / HEAD.
Comment #3
bajakan commentedI applied these patches and still the forum category is not selected. Is there a way to debug this? I setup the drupal site two weeks ago version 5.x, I've also applied cac_lite patches. Thanks for all your help in advance :).
Comment #4
bdragon commentedYou need to
a) Use category_legacy to import the forum vocabulary if you haven't already.
b) Update the forum_nav_vocabulary variable to be the nid of the forum container. (Either edit the db or call variable_set('forum_nav_vocabulary', nnn); where nnn is the nid.)
c) Update the forum_containers variable to store the cids of the "container" categories (yeah, very confusing terminology when using forum with category...) I highly recommend that if you aren't familiar with serialized PHP variables that you do something like variable_set('forum_containers',array(aaa,bbb,ccc,ddd...));
Comment #5
bajakan commentedOk tested with a new forum and works as described. Thanks! Not sure about updating those variables m(O.O)m, I don't even remember, looks like I created the old forums incorrectly though. Thanks again for your help.
Comment #6
JirkaRybka commentedI patched category_legacy to import Forum correctly, i.e. update Forum's structures (variables and also database plus URL aliases) automatically while importing. The patch is in my separate Issue here: http://drupal.org/node/158683
Comment #7
JirkaRybka commentedJust adding feedback: I've applied both the patches from #2 (the just-linked one being important), and it seems that all my problems are gone, Forums working fine (production site will be the final hard test, though, haven't finished this yet). Thanks a lot.
Comment #8
JirkaRybka commentedTo the remaining problem #1:
I think that the solution is much more simple, no need to build fake forms etc. The containers belonging to the Forum may be easily recognized by checking the column "module" in the table "category_cont", or "vocabulary" if using wrapper (or perhaps just node->module, if that is set). The value for Forum containers is simply just 'forum'.
Forum itself uses this identificator on "vocabulary" table, if regenerating its variable "forum_nav_vocabulary".
Comment #9
JirkaRybka commentedThis issue was previously discussed for 5.x version, so changing status accordingly.
The 5.x fix at #2 works fine - apart from problem 1 (which is minor, and only just administrative page) the module attached at #2 (in conjunction with the linked patch) solves pretty much everything. With that, I run Forum+Category on production site for almost 2 years now, without any problems. These fixes really deserve to get into the 5.x release (maybe too late now, but still I feel this way).
--------------------------------
Summary for Category 6.x-2.0-beta2:
- Problem 1 (Removal of "critical vocabulary options") still stands, but just like I said above, it's minor. I would go the documentation way - perhaps add some warning to that form through hook_form_alter(). That should be sufficient, as this is facing only site administrators.
- Problem 2 (forum_validate files an error aginst the taxonomy element if a container is selected) is fixed along-the-way by #115693: Simplenews and Forum broken due to missing taxonomy in node forms. Although the error is still filed against a non-existent form element with that patch (minor theming difference - no red outline), the Forum validation works fine in terms of catching illegal choices. So no need for another fix beyond the linked issue.
- Problem 3 (forum_prepare injects a taxonomy element to set the default forum when posting based on arg(3)), strictly taken, still stands - but the real problem of pre-selected forum vanishing from default values in the node form is covered by #464542: Restore the ability to have pre-selected category on node/add, which restores a similar arg(3) functionality in category.module (was already there before, and is called for by other users/use cases too), making the taxonomy inserted from Forum module unnecessary.
- Problem 4 (forum_link_alter looks for taxonomy_term links and changes the paths to point back to forum) doesn't exist on 6.x anymore. The links are created correctly through forum_term_path() being invoked from our wrapper's taxonomy_term_path(), so the 6.x workflow on links is flawless and needs no fix.
- Additional patch linked at #2: Ported to D6 at #115693: Simplenews and Forum broken due to missing taxonomy in node forms.
So, to recap (6.x): #1 is minor, #2 have a patch on another issue, #3 have a patch on another issue, #4 doesn't exist on 6.x entirely. Nothing to do here for 6.x, as soon as #115693: Simplenews and Forum broken due to missing taxonomy in node forms and #464542: Restore the ability to have pre-selected category on node/add get fixed.
Issue still stands for 5.x.