If you have a mid level site built on Drupal CMF, and made a mistake (using user accounts as author nodes) like me, there is still hope.
I have around 370 user accounts that refers to virtual authors. Long ago we didn't have nice tools and modules to create virtual author nodes, pages like Wordpress has for author information...
Anyways I had to convert these accounts to taxonomy terms and bind the article nodes to these terms. I did the following.
Task #1: Take all (virtual author) user accounts and export them.
I added these users to a specific user group called authors before so they got the role id 5. Without this I'd be in trouble :)
This little query takes all accounts I need to export as CSV format. I installed the taxonomy_csv module for the import job. I think it is easier than taking care all the relations Drupal tables has around term and node. I just created a new vocabulary (Authors) for the terms to import. With this module it was a 5 minute job. Nice.
Task #2: Take all terms under Authors vocabulary (vid = 10) and bind them to the nodes exactly the same way as the virtual authors (users) were.
I wrote this query to get all the articles and terms to be bound:
Cool. After filtering out the unimportant junk, I got the necessary sql dump to import to term_node table.
Thats all.
0 comments:
Post a Comment