# Ning import script

**URL:** https://meta.discourse.org/t/ning-import-script/24358
**Category:** Feature
**Tags:** feedback
**Created:** [January 23, 2015, 5:29pm UTC](https://meta.discourse.org/t/ning-import-script/24358 "2015-01-23T17:29:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [January 23, 2015, 5:29pm UTC](https://meta.discourse.org/t/ning-import-script/24358/1 "2015-01-23T17:29:28Z")

</div>

Today I pushed an [importer script for Ning](https://github.com/discourse/discourse/blob/master/script/import_scripts/ning.rb). I’ve only used it for one site, and plan to use it for a second site soon. I’m sure there will be many improvements to be made because no two imports are ever the same!

As with all importer scripts, edit the constants near the top of the file to point to your [Ning archive files](http://www.ning.com/help/?p=5219) and set other options specific to your data.

Let us know if you’re doing an import from Ning. Contributions to improve this script are welcome!

* * *

**NOTE** : Ning 3.0 (the newest?) doesn’t have a way to export your data at all. So this importer can’t help unfortunately.

---

<div class="post-metadata">

### Author: ![askmanny](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/askmanny/32/36343_2.png) [@askmanny](https://meta.discourse.org/u/askmanny)
#### Post date: [February 2, 2015, 11:04pm UTC](https://meta.discourse.org/t/ning-import-script/24358/2 "2015-02-02T23:04:35Z")

</div>

We are working with @codinghorror at Discourse on migrating two networks from Ning.

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [February 4, 2015, 7:29pm UTC](https://meta.discourse.org/t/ning-import-script/24358/3 "2015-02-04T19:29:11Z")

</div>

One issue I have run in to. It appears everyone imported as Level-1 users or higher. That included lots of users who have no posts associated with them. Seems like we would want those type of user accounts to come in as Level-0 only.

Any way to “mass correct” user levels to match the rules of the forum?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 4, 2015, 7:33pm UTC](https://meta.discourse.org/t/ning-import-script/24358/4 "2015-02-04T19:33:50Z")

</div>

That trust level is generally not set by the import, but by your local site settings for default trust level. Any comment here @neil?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 4, 2015, 9:33pm UTC](https://meta.discourse.org/t/ning-import-script/24358/5 "2015-02-04T21:33:23Z")

</div>

> [@badevguru](#):
>
> Any way to “mass correct” user levels to match the rules of the forum?

Should work:

```ruby
# cd /var/discourse
# ./launcher enter app
# rails c
User.all.each do |user|
  cnt = Post.where(user_id: user.id).count
  if cnt == 0
    user.change_trust_level!(0)
  end
  # user.save # - shouldn't be needed here
end

```

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [February 4, 2015, 9:48pm UTC](https://meta.discourse.org/t/ning-import-script/24358/6 "2015-02-04T21:48:53Z")

</div>

Thanks @riking. Something like that will need to be added to the script.

@askmanny I notice that many users in Ning have “comments” attached to them, typically saying “Happy Birthday!”. Discourse doesn’t allow people to post public comments on user profiles. Any thoughts about how they should be imported?

---

<div class="post-metadata">

### Author: ![askmanny](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/askmanny/32/36343_2.png) [@askmanny](https://meta.discourse.org/u/askmanny)
#### Post date: [February 5, 2015, 1:44am UTC](https://meta.discourse.org/t/ning-import-script/24358/7 "2015-02-05T01:44:50Z")

</div>

We are having discussions about these kinds of comments, and how to go channel the need for them.

One possible approach is to create a Forum category that (moving forward) serves as a place for people to have more ‘general’ conversations like the ones people would have in the “town square”, more akin to the kinds of conversations that would happen between individuals, as opposed to community-wide topics. Makes sense?

Any thoughts?

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [February 11, 2015, 6:43am UTC](https://meta.discourse.org/t/ning-import-script/24358/8 "2015-02-11T06:43:10Z")

</div>

It would be nice if the user portion of the import would default the “last seen” to the “created date” of the account. By default, that **should** (if I understand the restrictions) cause anyone that created an account in the last 365 days [default] to receive an email digest from the forum.  
As it is now, the system does not appear to email the digests to anyone until they login the first time to the migrated forums.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [February 11, 2015, 8:17pm UTC](https://meta.discourse.org/t/ning-import-script/24358/9 "2015-02-11T20:17:06Z")

</div>

Good idea. After doing that, the import scripts should also do this to get a better approximation for people who have posted:

```sql
UPDATE users
SET last_seen_at = last_posted_at
WHERE last_posted_at IS NOT NULL;

```

I’ll make the changes.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 12, 2015, 3:03am UTC](https://meta.discourse.org/t/ning-import-script/24358/10 "2015-02-12T03:03:19Z")

</div>

That should probably exclude rows where `last_seen_at` is set, in case a future importer actually imports that data.

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [February 19, 2015, 7:03pm UTC](https://meta.discourse.org/t/ning-import-script/24358/11 "2015-02-19T19:03:21Z")

</div>

It would be an improvement if the script would set the imported users default email settings to be the same defaults as any new user. Specifically the digest = weekly. At the moment, the import leaves the digest setting unselected.

It’s asking a lot of the users in a migration to have to proactively change settings and opt-in to the digest.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 19, 2015, 8:08pm UTC](https://meta.discourse.org/t/ning-import-script/24358/12 "2015-02-19T20:08:34Z")

</div>

The digests for imported users are currently not enabled because of this line.

> <https://github.com/discourse/discourse/blob/main/script/import_scripts/base.rb#L104>

As I see it this is done to prevent sending digests during / immediately after the import.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 20, 2015, 12:32am UTC](https://meta.discourse.org/t/ning-import-script/24358/13 "2015-02-20T00:32:59Z")

</div>

@neil this feels like a bug to me. Shouldn’t email be globally disabled anyway during imports / migrations?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [February 20, 2015, 3:27pm UTC](https://meta.discourse.org/t/ning-import-script/24358/14 "2015-02-20T15:27:47Z")

</div>

Yeah that’s a bug. Emails are disabled during import (as that code snippet shows), but we shouldn’t be changing `default_digest_email_frequency`. Digest emails won’t be sent during import. I’ll fix.

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [February 28, 2015, 3:19am UTC](https://meta.discourse.org/t/ning-import-script/24358/15 "2015-02-28T03:19:18Z")

</div>

When you import users, how do they get the welcome email?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 28, 2015, 3:25am UTC](https://meta.discourse.org/t/ning-import-script/24358/16 "2015-02-28T03:25:38Z")

</div>

Tell them to check [`/my/private-messages`](https://meta.discourse.org/my/private-messages), it’ll be there.

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [February 28, 2015, 3:29am UTC](https://meta.discourse.org/t/ning-import-script/24358/17 "2015-02-28T03:29:46Z")

</div>

Just reviewed the account of an imported user. None of the educational PM messages are sent.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [February 28, 2015, 9:15pm UTC](https://meta.discourse.org/t/ning-import-script/24358/18 "2015-02-28T21:15:48Z")

</div>

Imported users don’t get sent a welcome email. Moving users to the new forums is typically done gradually, by posting announcements on the old forums, pinned topic(s) on the new forums, blog posts, etc. I think it also makes sense to seed the welcome private message for all imported users too, so I’ll look into adding that to our importers.

---

<div class="post-metadata">

### Author: ![badevguru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/badevguru/32/115121_2.png) [@badevguru](https://meta.discourse.org/u/badevguru)
#### Post date: [March 3, 2015, 7:31pm UTC](https://meta.discourse.org/t/ning-import-script/24358/19 "2015-03-03T19:31:32Z")

</div>

One issue we ran in to was that Ning refused to export all off the profile pictures using their export tool. We went ahead with the import, but that left the system in a weird state where the have a blank profile picture.

The side effect for new users is that they don’t know there is an important menu option!

![](https://global.discourse-cdn.com/meta/original/3X/1/c/1c3982215070322ad439ebb7ac0fe8f97a93c344.gif)

Anyway to identify and correct affected accounts such that they pull the gravatar avatars as if they had never uploaded an image?

---

<div class="post-metadata">

### Author: ![Rodelio\_Lagahit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rodelio_lagahit/32/121638_2.png) [@Rodelio\_Lagahit](https://meta.discourse.org/u/Rodelio_Lagahit)
#### Post date: [November 6, 2015, 4:08am UTC](https://meta.discourse.org/t/ning-import-script/24358/20 "2015-11-06T04:08:53Z")

</div>

any updates on this importer? is it functional now?

[Next page](https://meta.discourse.org/t/ning-import-script/24358.md?page=2)
