# Important question about importing users

**URL:** https://meta.discourse.org/t/important-question-about-importing-users/127140
**Category:** Development
**Created:** [August 29, 2019, 4:55pm UTC](https://meta.discourse.org/t/important-question-about-importing-users/127140 "2019-08-29T16:55:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ramjke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ramjke/32/150397_2.png) [@ramjke](https://meta.discourse.org/u/ramjke)
#### Post date: [August 29, 2019, 4:55pm UTC](https://meta.discourse.org/t/important-question-about-importing-users/127140/1 "2019-08-29T16:55:11Z")

</div>

Hello, community. I’ve been learning and remaking an import script for my site on Livestreet CMS for a couple of weeks. I have already finished writing the script, it remains to clean it up and make a pull request.

I have already imported all users too, with the exception of those who use authorization through services. The question is: **How to import those users from a donor site to a Discourse who use authorization via Facebook or Google?** I want to find the most elegant solution. The problem is also that some Facebook users do not have emails.

### Bonus! Importing likes with date\_added parameter.

I also found another method to import likes with a date, since the old method in other scripts does not work.

```
likes = mysql_query(<<-SQL
    SELECT target_id
         , user_voter_id
         , vote_date
         , target_type
      FROM #{TABLE_PREFIX}vote
     WHERE vote_direction = 1
     ORDER BY vote_date
SQL
).to_a

likes.each do |l|
  next unless user_id = user_id_from_imported_user_id(l["user_voter_id"])
  next unless post_id = post_id_from_imported_post_id("post-#{l["target_id"]}") 
  next unless user = User.find_by(id: user_id)
  next unless post = Post.find_by(id: post_id)
  PostActionCreator.create(user, post, PostActionType.types[2], created_at: Time.at(l["vote_date"])); #PostActionType.types[2] is like
end

```
