Tags are being imported as numbers

kmonty - November 27, 2009 - 17:34
Project:Wordpress Import
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:lavamind
Status:closed
Description

I just ran an import and the categories are imported perfectly however the tags appear as numbers. (See screenshots of the front page and edit node page).

Below is a sample of my xml dump. Any ideas?

<wp:category><wp:category_nicename>sports</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Sports]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>theater</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Theater]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>travel</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Travel]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>video</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Video]]></wp:cat_name></wp:category>
<wp:tag><wp:tag_slug>eww-i-think-there-is-gum-stuck-to-my-back</wp:tag_slug><wp:tag_name><![CDATA["eww I think there is gum stuck to my back"]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>okay-thatll-be-a-box-of-condoms-some-strawberries-some-whipped-cream-and-some-catfood</wp:tag_slug><wp:tag_name><![CDATA["Okay that'll be a box of condoms some strawberries some whipped cream and some catfood"]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>tears</wp:tag_slug><wp:tag_name><![CDATA[#tears]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>deappropriation-project</wp:tag_slug><wp:tag_name><![CDATA[(de)appropriation project]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>1-77</wp:tag_slug><wp:tag_name><![CDATA[1.77]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>100-things-to-try-before-you-die</wp:tag_slug><wp:tag_name><![CDATA[100 Things to Try Before You Die]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>12-galaxies</wp:tag_slug><wp:tag_name><![CDATA[12 galaxies]]></wp:tag_name></wp:tag>

AttachmentSize
node_page.png7.09 KB
edit_node_form.png32.01 KB

#1

kmonty - November 28, 2009 - 03:03
Priority:normal» critical

I've been trying to track down the issue and what I have found so far is this:
1) The script initially imports all the tags correctly
2) When the script trying to import the entries, it does not accurately map the tags to their newly created drupal terms, so it creates new tags as numbers. (see attached taxonomy "list terms" screenshot)

Any ideas?

AttachmentSize
Screen shot 2009-11-27 at 7.05.48 PM.png 29.7 KB

#2

kmonty - November 28, 2009 - 04:07
Status:active» needs review

Found the bug. Function "wordpress_import_process_post_categories_tags()"

When you save the categories (which is not a "tags" vocabulary), the function saved the terms by term ID (which is how Drupal does it when editing a node). However, when you save something that has autocomplete freetagging, Drupal saves the terms by based on the text string, rather than an exploded string of term ids. I had to edit the section of the function that processed the tags to not do the conversion from text to tid:

// Process tags
foreach ($post['tags'] as $tag) {
  //$term = $wordpress_import->tags_map[$tag];
  if (!empty($tag)) {
      $drupal_tags[] = $tag;
  }
}
if (!empty($drupal_tags)) {
  $taxonomy['tags'][$wordpress_import->tags_vocabulary] = join(',', $drupal_tags);
}

#3

barraponto - December 6, 2009 - 19:26

i can confirm the bug. can you create a patch file so i can test your code?

#4

lavamind - December 8, 2009 - 06:41
Assigned to:Anonymous» lavamind
Status:needs review» fixed

Fixed in 6.x-2.x-dev.

Thanks!

#5

System Message - December 22, 2009 - 06:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.