Manual Insert Posts - Schema

I'd like to import some posts from my listserv/mailman archive.

Is there a simple API call I could make, or a list of INSERTS required so that we can parse our logs and insert our old data?


Jake Bunce

Well-known member
You need to insert into the xf_thread and xf_post tables.

If you can get the source data into separate tables in your XF database then you can do cross table inserts, like this:

Rich (BB code):
INSERT INTO xf_thread (thread_id, node_id, title, user_id, username, post_date, first_post_id, last_post_date, last_post_id, last_post_user_id, last_post_username)
	SELECT values, for, each, column
	FROM yourtable;

INSERT INTO xf_post (thread_id, user_id, username, post_date, message, position, like_users)
	SELECT values, for, each, column
	FROM yourtable;

Then rebuild your thread information afterwards:

Admin CP -> Tools -> Rebuild Caches