Decided upon Drupal after attempting several other mechanisms to serve the needs of my growing membership website. One of the tools I needed to migrate away from was bbPress as a forum tool.

I located and ran this importer after modifying it heavily to accommodate my table names, etc.

The result is that all of the users came across just fine, as did forum topics as nodes and their associated comments. I've followed other support posts and corrected vocabularies and taxonomy, as the importer tool I use is clearly dated enough that it must have been designed for an earlier version of Drupal. And as far as I can tell, everything appears to be in order.

The issue is that the imported forum topics are still not displayed in the forum overview. What's interesting is that the pagination is there as if the topics were being listed, but the only entries appearing in the list are the ones I've added in Drupal subsequent to the import.

In the content manager, if I edit an imported forum topic, I receive this error message:

An illegal choice has been detected. Please contact the site administrator.

Any ideas as to what I am missing?

Very grateful for your help...

Comments

cog.rusty’s picture

Have you already gone over the things listed in http://drupal.org/node/365973#comment-1226871 ?

Are your nodes of type "forum" (and only them) tagged with only one term from the Forums vocabulary, so that you don't have to deal with the complications of using the "forum" table discussed in http://drupal.org/node/380822#comment-1281210 ?

What exactly is not displayed? The list of post titles in a forum? (forum/nnn)
Is the content of individual forum posts displayed?
Are the teasers of the forum posts displayed in a taxonomy listing? (taxonomy/term/nnn)

Take a look at the watchdog (admin/reports/dblog) for more details about the "illegal choice" error.

epiphanymarketing’s picture

Thanks for the great response. I had combed through the forums to get the import to work, so most everything you mentioned here:

Have you already gone over the things listed in http://drupal.org/node/365973#comment-1226871 ?

I had already looked at. The one thing that was new there was that no entry existed in the variable table. I added a row with the following values:

name: forum_nav_vocabulary
value: s:0:"";

where 0 is the vid of the forum. Please let me know if that syntax is bad.

Are your nodes of type "forum" (and only them) tagged with only one term from the Forums vocabulary, so that you don't have to deal with the complications of using the "forum" table discussed in http://drupal.org/node/380822#comment-1281210 ?

There is only one entry in the term_node table for each of the nodes of type "forum". Is this what you meant?

What exactly is not displayed? The list of post titles in a forum? (forum/nnn)

That's correct. Only the post titles for the topics that have been added since the import appear when viewing forum/nnn. The imported topics do not appear there.

Is the content of individual forum posts displayed?

If I know the node ID for a forum topic, then I can view it by viewing node/nnn . Also, the associated comments will display correctly there.

Are the teasers of the forum posts displayed in a taxonomy listing? (taxonomy/term/nnn)

Yes they are! (Wow... I can answer "yes" to something!) This is good news, no?

Take a look at the watchdog (admin/reports/dblog) for more details about the "illegal choice" error.

Thanks for pointing me in that direction. Here's what I discovered:

Illegal choice <p><a href="/smp/members/filter/tips">More information about formatting options</a></p> in Input format element.

Thanks again for your help!

epiphanymarketing’s picture

Going back to edit a forum topic node, I realized that the "input format" had no option selected, which evidently was creating the "illegal choice" error... so I selected "filtered HTML" and saved the node.

This caused me to successfully be able to save the node, but it still does not appear in the list under forum/nnn .

So we can ignore that part of the problem...

Thanks!

cog.rusty’s picture

Was "Filtered HTML" selected as the "Default" input format in admin/settings/filters? That should be enough to make it selected by default when editing a post.

----- Edited to add:

You may need to go to the "node_revisions" table and set all the posts to format=1 (Filtered HTML).

epiphanymarketing’s picture

"Filtered HTML" was (and is, of course) set to the "Default" input format... but evidently the imported items did not have this value set on the way in... not sure if the import code I borrowed didn't address it or if I managed to muck that part up somehow...

I'm going through the node_revisions table to make those changes now...

epiphanymarketing’s picture

Sure enough, the format field was set to "3" for all of those imported items. Not sure where that value came from, but I wrote a quick query that fixed them all to 1.

cog.rusty’s picture

Normally 1 and 2 are the "Filtered HTML" and "Full HTML", the 2 input formats always created during installation.

3 can be either the "PHP code" input format, if the admin enabled the "php filter" module next, or a user-defined input format. You can figure out which by looking at the list of input formats in admin/settings/filters. If there are only 2 listed, that should have been a problem.

Did that fix anything?

epiphanymarketing’s picture

But it didn't resolve anything.

I may now be worse off, actually. In my efforts to change the vocabulary ID for the forum, I decided to follow your full train of thought on the other post and uninstalled the forum, then reactivated it.

I now have a new vocab ID, and have re-created my containers and forums... but now I can't get any of the old topics (imported or not) to show up... I'm going back over everything with a fine-toothed comb here...

cog.rusty’s picture

You shouldn't have done that on a forum with posts which you wanted... All the entries of the posts in the "term_node" table won't have you new containers as terms. This is unworkable.

You should have just changed the vid 0 everywhere, which was not much work.

epiphanymarketing’s picture

I did change the vid 0 everywhere first. But since that did not solve the problem, I decided to give this a try.

It deleted my forums and containers (easy to rebuild). The forum table is empty, so I might need to put some data back in there. So... we're back to the original question... presumably it is possible to import forum data... correct?

All of the nodes are still there... there must be a way to "attach" them to the proper containers and get them to display...

I've begun by editing the records in the term_node table.

cog.rusty’s picture

The "forum" table usually stays empty. It may have a few rows for some special cases (for example moved forum topics).

The meat is in the "term_node" table. That is where terms from the Forums vocabulary (which represented containers and forums) were assigned to nodes. It is a disaster:
- If these term assignments were lost, you might as well start over with the import.
- If these term assignment still exist, they are currently almost useless. Their term IDs are completely different from the tids that you have in your new Forums vocabulary, and fixing your new tids may take a lot of work. So, again, you must consider starting over.

epiphanymarketing’s picture

I thought as much...

If I start over... any thoughts as to how to make sure the import is conducted in such a way as the records actually display? Should I consider an alternative method rather than getting the data straight into the database?

cog.rusty’s picture

I think the database import is the only realistic solution to get you close. Other methods, such as capturing an RSS feed into nodes, would still need attaching the nodes to the terms of th right vocabulary, which is a lot of work.

You should know a lot about what needs to be done by now. It is possible that at the point that you ran the uninstaller you just needed to clear some cache tables.

epiphanymarketing’s picture

The term_node table got cleaned out, so I made some new entries into the forum to double-check and make sure that new entries would display correctly.

I also added several rows to the term_node table for the nodes that I imported previously just to see if they would show up. They do not. It's clear that something happens in Drupal when a new forum topic gets created that is not occurring in my database with the records I imported... I've gone over everything with a fine-toothed comb... I've scoured these forums... there must be something I'm missing...

epiphanymarketing’s picture

cog.rusty: Just wanted to reiterate my sincere gratitude for your help here. You've spent significant time assisting me and I really appreciate it.

Thought you'd be interested in another tidbit. Just to make it clear, there are now 3 different groups of forum topics in my database:

Group 1: topics I imported initially
Group 2: topics I added in Drupal before uninstalling and reactivating the forum module
Group 3: topics I added in Drupal after uninstalling and reactivating the forum module

Up until just a few minutes ago, only Group 3 were listed when viewing /forum.

I researched some information about the node_comment_statistics table, which seems to be an essential part of the query that runs when the forum attempts to display information.

So... I looked in that table and found that my Group 3 and Group 2 forum topics had rows there (none of the Group 1 topics had rows there). So I added rows corresponding to the nids from the Group 2 topics in the term_node table to see if I could get them to appear on the site.

Now, oddly, one of the Group 2 topics shows when I view the forum. BOTH of them appear in the block I have configured to sit in the right-hand sidebar of the site. So... there's a topic in the block on the right that does not appear when I view the forums.

So now I'm scouring the database for other records related to the Group 2 topic that shows in both the sidebar and in the forum overview.

epiphanymarketing’s picture

More research on the node_comment_statistics table led me to discover that:

If a topic exists in the term_node table, AND
if it also exists in the node_comment_statistics table, AND
if it also exists in the forum table

It displays properly.

So... I used a code snippet from http://drupal.org/node/50151#comment-137637 to rebuild the node_comment_statistics table. It worked beautifully.

So, began adding rows to the node_comment_statistics table and the forum table for each of my topics. It was a bit painstaking, but each one appears on the site as I do it.

Then... I discovered another shortcut. This is now causing my topics to appear:

  1. Display the node by number (node/nnn)
  2. Edit the node
  3. Assign it to a forum using the drop-down box
  4. Check the "Leave a shadow copy" (thanks to cog.rusty for helping me understand that this creates a row in the forum table)
  5. Save the node

I just have to edit each topic one at a time... still a bit time-consuming, but after all the time I've spent on this, I am now seeing daylight!

Thanks again for your help, cog.rusty. I couldn't have done it without you!

cog.rusty’s picture

Did you try clearing the cache tables during these experiments?

epiphanymarketing’s picture

Unless like you mentioned they might've gotten cleared during the uninstall of the forum module, I'm not aware of having cleared them. I can tell you that since you mentioned them a couple of posts earlier, I hadn't bothered to look at them. But none of them have any significant data in them as of right now... (at least not related to the forums).

cog.rusty’s picture

No, I didn't mean to look for significant data in them. What I meant was that when everything was looking correct and it still didn't work, a logical next step at that time was to empty the cache tables.

epiphanymarketing’s picture

Now that I'm aware of them, I'll keep that in mind in the future. I didn't do so in this process.

Thanks again for all your excellent help!

epiphanymarketing’s picture

After further investigation, I spotted your reply to this comment: http://drupal.org/node/380822#comment-1281546 and changed the syntax of the "value" field for the forum_nav_vocabulary row in the variable table. It now reads:

s:1:"0";

So... that appears to be in place but apparently does not solve the problem.

cog.rusty’s picture

Why "0"? Does your Forums vocabulary have ID "0" in admin/content/taxonomy? (when you hover over the "edit" link) I don't think this is possible. Normally its is >= 1.

That should be the same vid used in the vocabulary table, in the term_data table, and in the vocabulary_node_types table for your forum posts.

epiphanymarketing’s picture

The Forum vocabulary is ID 0. This was the first vocab created after Drupal was installed... the forum was the first module I activated. The vid is the same in the vocabulary table, term_data table, and in vocabulary_node_types...

Is it not normal for the first vocab to have ID 0?

cog.rusty’s picture

I have never seen it before. The first vocabulary that you create is assigned 1. Did the script do that?

Maybe this is unimportant, maybe not. I don't know what any Drupal code may assume. If you decide to replace it, watch out for the tables where "vid" means "revision" and not "vocabulary". Basically it is in the tables that I mentioned in that check list (but not "node_revisions" and not "forum").

epiphanymarketing’s picture

At this point, I've tinkered enough that I don't recall with 100% certainty where the vid=0 came from. I guess it may be worth changing if a script might not like it... I'll tinker some more in a bit...

epiphanymarketing’s picture

One more side note (in case it's useful):

When viewing /forum , the "statistics" includes the correct count of "topics" and "posts". This leads me to believe that the forum topics are correctly associated with the forum.

Also, when viewing /forum/nnn , pagination links are displayed ("1" "2" "3" "4" "Next" "Last") even though the topics themselves (those being displayed, which are currently only the new ones added since the import was completed) aren't enough to fill up even the first screen.

Thanks!