Here is a simple Mysql code to import contents and forum posts from a joomla+simpleboard to drupal+UIE Forum. Here is a simple guide to migrate from joomla to drupal. I have chosen UIE Forum due to similarity between UIE and simple board tables.

1- Backup your drupal database !!!!!!!!!!!
2- Copy jos_categories, jos_content, jos_sb_categories, jos_sb_messages, jos_sb_messages_text, jos_users tables to drupal database
3- Modify this script according to your needs
4- Run it.
5- Reset forum counters

############################ CONTENT MIGRATION ############################
# Get all records from joomla table and add to drupal tables
# Clear content of node table put comment mark inorder to disable
TRUNCATE TABLE node;
# generate content of node table put your table names and content type inorder to customize
INSERT INTO node SELECT id, id, 'story', title, created_by, state, UNIX_TIMESTAMP(created),  UNIX_TIMESTAMP(created), 0, 0, 0, 0 FROM jos_content;
UPDATE sequences SET id = (SELECT MAX(nid) FROM node ) WHERE name='node_nid'; 
# Clear content of nodrevisions table put comment mark inorder to disable
TRUNCATE TABLE node_revisions;
#generate node_revisions table from jos_content table
#you need to put name of joomla table before fulltext otherwise script gives error
INSERT INTO node_revisions SELECT id, id, created_by, title, CONCAT(introtext, jos_content.fulltext),  introtext, ' ', UNIX_TIMESTAMP(created) , 3 FROM jos_content;
UPDATE sequences SET id = (SELECT MAX(vid) FROM node_revisions ) WHERE name='node_revisions_vid';
TRUNCATE TABLE vocabulary;
#Now we will create vocaublary and terms to provide section-category hierarchy in joomla
INSERT INTO vocabulary (name,description,hierarchy,multiple, required, module) VALUES ('Content Category', 'Categories for the imported content', 1, 1, 1, 'taxonomy' );
UPDATE sequences SET id = (SELECT MAX(vid) FROM vocabulary ) WHERE name='vocabulary_vid';
TRUNCATE TABLE vocabulary_node_types;
#add vocabulary_node_types content by 
#again you need to replace content type parameter biggest vocabulary id is selected as vid which is, practically, the one we just added
INSERT INTO vocabulary_node_types (vid, type) VALUES( (SELECT MAX( vid ) FROM vocabulary), 'story' );

TRUNCATE TABLE term_data;
# now we will import whole category hierarchy since in my situation importing just categories is enough
#if you need to import sections also you need to add some lines more
#I 've inserted 9999 for vid parameter since i will replace it at next line by biggest vocabulary id
INSERT INTO term_data SELECT id, '9999', title, description, ordering  FROM jos_categories WHERE section NOT LIKE '%com_%';
#I use where to filter non content categories
#Now replace 9999 with actual vocabulary id value
UPDATE term_data SET vid=(SELECT max( vid ) FROM vocabulary) WHERE vid=9999;
UPDATE sequences SET id = (SELECT MAX(tid) FROM term_data ) WHERE name='term_data_tid';
TRUNCATE TABLE term_hierarchy;
#We need to insert category hierarchy to term_hierarch table
INSERT INTO term_hierarchy SELECT id, parent_id FROM jos_categories WHERE section NOT LIKE '%com_%';

TRUNCATE TABLE term_node;
#We have imported both categories and contents but we have to link them by importing data for term_node table
INSERT INTO term_node SELECT id, catid FROM jos_content;

TRUNCATE TABLE users;
#We have all content but we also need users don't we
#I have put 7200; for timezome for GMT+2 find proper one for you and replace it
INSERT INTO users SELECT id, username, password, email, 0, 0, 0, ' ', ' ', UNIX_TIMESTAMP(registerDate), UNIX_TIMESTAMP(lastvisitDate), UNIX_TIMESTAMP(lastvisitDate), 1, '7200;', ' ', ' ',' ',' ' FROM jos_users; 

# Since we already dropped admin account we need an admin account so we are going to promote default joomla superadmin user to administrator by updating his/her userid to 1
#Note joomla superadmins default id is always 62

UPDATE users SET uid = 1 WHERE uid=62;

#Since we changed user id to 1 we need to update content owners

UPDATE node SET uid = 1 WHERE uid=62;
UPDATE node_revisions SET uid = 1 WHERE uid=62;


############################ CONTENT MIGRATION ############################

#Untill now we have done everything to migrate from default joomla to default drupal
#You can neglect extra code if you don't need

############################ FORUM MIGRATION ############################
#This code is for migrating from joomla simpleboard to UIE Forum
#I have chosen UIE instead of core forum module because UIE provides more fuctionality and database structure is much more close to simpleboard which ease migration
TRUNCATE TABLE F_Forums;
#Firstof all we will import forum categories
#Note that I have added 1 to all id and parentid values and set 0 for all count values
INSERT INTO F_Forums SELECT 1, 'Forums', NULL, 'Top forum', 0, 1 , 0, 0, 0, 0;
INSERT INTO F_Forums SELECT id+1, name, parent+1,  description, 0, 0, 0, 0, 0, 0 FROM jos_sb_categories;
 

TRUNCATE TABLE F_Threads;
#Import threads
INSERT INTO F_Threads SELECT id, subject, userid, time, NULL, NULL, 0,0, catid+1, hits, 1 FROM jos_sb_messages WHERE moved=0 AND parent=0;


TRUNCATE TABLE F_Posts;
#Import messages
#Note I have left content variable blank since message contents and other params are stored sepperately at simple board
INSERT INTO F_Posts SELECT id, subject, thread, userid, time, ' ', 0, 0, NULL, NULL  FROM jos_sb_messages;
UPDATE F_Posts SET Content= (SELECT message FROM jos_sb_messages_text WHERE jos_sb_messages_text.mesid= F_Posts.PostID);

#Since we changed user id to 1 we need to update forum content also

UPDATE F_Threads SET Creator = 1 WHERE Creator=62;
UPDATE F_Posts SET Poster = 1 WHERE Poster=62;

#Update last post variables at threads and forums table

UPDATE F_Threads SET LastPoster=(SELECT Poster FROM F_Posts WHERE F_Posts.ThreadID=F_Threads.ThreadID ORDER BY Posted DESC LIMIT 1 ), LastPost = (SELECT Posted FROM F_Posts WHERE F_Posts.ThreadID=F_Threads.ThreadID ORDER BY Posted DESC LIMIT 1);


############################ CHAR CORRECTION ############################
#This part is to correct some chracter issues

UPDATE F_Posts SET PostTitle= (SELECT REPLACE(PostTitle, '&', '&' ));
UPDATE F_Posts SET Content= (SELECT REPLACE(Content, '&', '&' ));
UPDATE F_Threads SET ThreadTitle= (SELECT REPLACE(ThreadTitle, '&', '&' ));
UPDATE F_Forums SET ForumName= (SELECT REPLACE(ForumName, '&', '&' ));
UPDATE F_Forums SET ForumDesc= (SELECT REPLACE(ForumDesc, '&', '&' ));

UPDATE F_Posts SET PostTitle= (SELECT REPLACE(PostTitle, "\\'", '"' ));
UPDATE F_Posts SET Content= (SELECT REPLACE(Content, "\\'", '"' ));
UPDATE F_Threads SET ThreadTitle= (SELECT REPLACE(ThreadTitle, "\\'", '"' ));
UPDATE F_Forums SET ForumName= (SELECT REPLACE(ForumName, "\\'", '"' ));
UPDATE F_Forums SET ForumDesc= (SELECT REPLACE(ForumDesc, "\\'", '"' ));
############################ /CHAR CORRECTION ############################
############################ /FORUM MIGRATION ############################

I have written this script about a month ago. It worked for me but I don't remember if this is the final version. If you try and fail please inform me.

Good luck!

Comments

hannesh’s picture

Worked great with 1.0.15 ro 5.7, but
Any luck with converting to 6.2.
From J!1.5 to 5.7 or 6.2?

LiquidWeb’s picture

its possible but I haven't used joomla 1.5 so didn't need to convert but if you want too much I can have a look on it. I can help more if you can give details about your site like used modules& components for both joomla & drupal

hannesh’s picture

great!
Thank you very much for you helpfulness.
It seems, that the script works with J! 1.5 without any modifications. Although from Joomla 1.0.15 to Drupal 5.7 it did create problems with commenting, I got an error message http://drupal.org/node/245315 and commenting did not function any more. But when i cut the lines
from
TRUNCATE TABLE users;
...
to

UPDATE users SET uid = 1 WHERE uid=62;
it seems to be working fully.

But, if it is at all possible, i do have a predicament with huge amount of comments (about 3000) from mxc comment.
Thank you!

hannesh’s picture

I used it on a small site (100 nodes) nothing much extra, everythings great and now i wanted to get to the main work with 4000 nodes and use the same script, but after applying it i get a page full of
"warning: Invalid argument supplied for foreach() in
public_html/ek/modules/taxonomy/taxonomy.module on line 1329."
when running the cron job and worst of all not all nodes are showing in Drupal, only a selection of them, only from some categories, although the database has the nodes in it. Everything seems in jos_content and jos_cat similar to the first one. This failure with the cron job appeared already after i only applied the beginning of the script (just before TRUNCATE TABLE vocabulary;), thought, that it came from some taxonomy, term failiure.
any help is most appreciated! the more i use it more i begin to love drupal, but these 4000 articles...

hannesh’s picture

after i ran out of ideas, i added a post to this faulty installation and wuallah, for some reason the script here wrote the uid in node table as something else as "1", the number, that was added to the correctly posted node. A newbie, i deleted it altogether, added again the uid row, with "1" as default, and every node was showing, with the pesky long taxonomy module error codes gone.
Rejoice, after more than 5-8 weeks, can even remember. Many full days work went into solving this, and now in 15 min. This is one for the books.