Forem Creators and Builders 🌱

Paul Gilzow
Paul Gilzow

Posted on

Bulk programmatic update of author?

TL;DR - is there a way to update the author of a collection of articles in bulk?

I'm brand new to Forem. I'm in the process of migrating our Discourse site to a self-hosted instance of Forem. My searches for migrations and importation from something else into Forem has not turned up many results. The best option I have found so far is to use the RSS import option. This works but is a per person import. What I would like to do instead (absent of a better solution) is to import all the content from discourse via rss into Forem under the generic admin user. From there change the author to the correct author. I have found in the admin --> Content Management --> Posts the ability to change the user id, but it appears to be a one-by-one change. I'd prefer to change the author id in bulk.

I thought I could accomplish this via a SQL update on the articles table changing the user_id to the correct author, but it appears that this table is not the only location that associates the article with an author. I mention that because even though in various listings it shows the "correct" author, the slug for the article is still the admin account, and the "edit" button from the content management screen goes to a 404 for those changed articles. In addition, if the user logs into their account, while the articles are listed in their dashboard, their post count shows 0 and attempting to edit any of their posts ends in a 404.

Is there a publicly accessible ERD for Forem? Or does any know of a more efficient way to bulk change a collection of articles from one user to another?

Oldest comments (0)