I have set up a forum and Discuss This! with basically the minimal options (I've allowed just the book type to be discussed, in the Test forum).
Now, when I create a topic everything seems to go fine (as you can see from the first picture). The discussion topic node is created with its first comment and everything looks fine.
However, when I click on the link "Un forum de test" to look at the forum as a whole... the forum is empty (see second picture). Looking in my database, it seems that the one thing that has not happened is an update to the "Forum" table.
This seems bizarre to me since I would have thought this would be a really basic bug that everybody would be worrying about... Even if I have done something wrong in the configuration, this should not be happening since it creates an incoherence in the web site with Forum type nodes orphaned from their forum.
| Comment | File | Size | Author |
|---|---|---|---|
| DiscussThis02.PNG | 19.86 KB | joel_guesclin | |
| DiscussThis01.PNG | 33.37 KB | joel_guesclin |
Comments
Comment #1
AlexisWilke commentedHa! Ha!
In my haste I did not notice. I had many other posts so it did not occur to me look at that closely. I will definitively fix that one!
Thank you.
Alexis
Comment #2
joel_guesclin commentedI tried putting a "dprint_r" of sub_form_state just before and a "print_r" of the "topic" object just after the drupal_execute on forum_node_form (line 659) and here is what i got:
BEFORE (note by the way that I actually configured the user id in Discuss This! admin - since i did not want it appearing as "Anonymous")
AFTER
Don't know if this helps. The Forum tid is indeed 20 by the way, so it looks as if that is getting uncovered correctly which was my first thought
Comment #3
AlexisWilke commentedJoel,
The tid should be set on the node as $node->tid. But it looks like that does not happen...
I could just do the insert in the forum myself, but the fact that it fails makes me think a validation function did not run when it should have...
Thank you.
Alexis Wilke
Comment #4
joel_guesclin commentedI look forward to a fixed version - this is a really cool module and I very much hope to be able to use it soon! If I can help with more testing let me know.
Comment #5
joel_guesclin commentedHere is a hack which is not very nice but which seems to do the trick. I noticed that in discussthis_nodeapi the "insert" operation did not do anything and just drops through to the update (is this intentional?).
So I tried doing this:
Not very elegant I know but it does seem to work. At least, the bit to set the tid seems to work - however the bit of code to set the node uid to the user uid still fails to get the forum topic to appear as anything other than "Anonymous".
Another oddity is that when I create a new Story and set the "Discussthis" forum to something other than the default, it doesn't "take" - you have to go back and modify it again to get that to work.
Comment #6
joel_guesclin commentedActually of course I realise that the correction of the user id bug can't be done here, precisely because you only get into discussthis_nodeapi AFTER the node has been created (with the wrong user id). So here is a tidier version of the code which seems to fix the bug of not loading the initial post in the forum (in discussthis_nodeapi):
I think this should work under all circumstances because logically a forum post can only belong to one term. Unless of course you allocate a second vocabulary to forum entries - so perhaps you should get the forum vid variable first and make sure that you check that one only. Maybe I'll try that later to make it a bit more robust.
Comment #7
AlexisWilke commentedJoel,
Note that in #5 you use global $user. This is the wrong user. The correct one is defined in the discussthis variables.
Otherwise, I'd rather use the correct tid instead of trying to get one from some "random" $node->taxonomy. 8-)
The following is the code from the forum. I'm wondering why wouldn't that code kick in?! And from what I can tell, I may have one too many arrays in discussthis?
So if foreach($node->taxonomy as $term_id) is expected to extract the term identifiers, I think we'd need something like this around line 647 in discussthis.module:
I guess that would be because that taxonomy is marked as single term (opposed to Multiple terms). Which means depending on some flags, the lists of terms in the taxonomy is different. Well! That's crazy. But if that works, who cares. 8-)
And I tested and it works. So that's what it was! Darn! I don't like the handling of terms. The guys who wrote that are just plain crazy. Special cases for each flag in the table!!!
Anyway... I'm checking in the fix. 8-)
Thank you for your work! I will look further for the user later (there is another topic for that, right? I'm marking this one as fixed...) It's a bit late here already.
Alexis Wilke
Comment #8
joel_guesclin commentedI should have seen that!
Actually (if you have not already done so), I think you could replace this:
with just this:
I've noticed that when you create a forum for the first time Drupal automatically creates a vocabulary (set in the 'forum_nav_vocabulary' variable) with enforced single terms, so it is not possible to have tags. This is logical if you think about it. There is only ONE vocabulary allowed which defines the forum structure, and it is necessarily a single-term vocabulary because otherwise you could have the same post in multiple forums which would not really make sense.
Comment #9
AlexisWilke commentedJoel,
It is a safe guard. Just in case somehow something changes and those other cases need to be handled. As long as this one case works, we should be okay. 8-)
Thank you.
Alexis
Comment #11
ChaosD commentedsubscribed
is there any progress on this?
Comment #12
AlexisWilke commentedI made the -dev version 1.1 (which should appear within 1h or so). Feel free to re-open this issue if you still have this problem (i.e. tid not properly attached to the posts) with version 1.1.
Thank you.
Alexis