"Manually" create new users

It’s probably too late now, but in case someone stumbles on this thread later, here’s my solution. I basically created a Ghost import file with users only, using the following format:

{
  "data": {
    "posts": [],
    "tags": [],
    "posts_tags": [],
    "users": [
      {
        "id": 1,
        "slug": "person",
        "bio": "I am a person on the website",
        "website": "https://www.example.com",
        "created_at": "Thu, 3 Aug 2019 13:45:57 +0530",
        "created_by": 1,
        "email": "person@example.com",
        "name": "Some Person",
        "profile_image": ""
      }
    ]
  },
  "meta": {
    "exported_on": "Thu, 3 Aug 2019 13:46:48 +0530",
    "version": "2.14.0"
  }
}

…with the following changes:

  • Replace the slug, bio, website, email and name with preferred values for the person (I think they’re optional apart from email)
  • Increment the id for each new record (IDs have to be unique to the file, but not necessarily to the database since Ghost will automatically assign an ObjectID before importing)
  • Change the date and time to the current date and time–you can do this manually, the format’s pretty straightforward. The +0530 at the end is my timezone, UTC +5:30; you can change it to your own if it really matters
  • Change the date and time for the meta.exported_on as well

When it’s all done, go to the “Labs” section of Ghost and run “import content”. And then voilà–your user will appear in the database!


You can probably save this as a template for importing more users in the future. And of course, if you want to import multiple users at a time, you can just duplicate the "users" object to add more people (don’t forget commas in between!). It’d be pretty straightforward to write a script automating the process, since it’s basically plaintext.

6 Likes