Ning import script

Today I pushed an importer script for Ning. 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 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.

7 Likes

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

1 Like

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?

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

Should work:

# 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
1 Like

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?

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?

1 Like

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.

1 Like

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

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

I’ll make the changes.

1 Like

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

1 Like

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.

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

https://github.com/discourse/discourse/blob/master/script/import_scripts/base.rb#L104

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

1 Like

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

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.

1 Like

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

Tell them to check /my/private-messages, it’ll be there.

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

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.

4 Likes

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!

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

any updates on this importer? is it functional now?