# Importing comments, posts are not getting created. Says user not present but the user is present

**URL:** <https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154>\
**Category:** Product Support\
**Created:** [November 16, 2017, 2:46am UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154 "2017-11-16T02:46:13Z")\
**Posts on this page:** 7\
**Page:** 1

## AI-generated summary

User **Quintin_Par** is experiencing issues importing Disqus comments into Discourse, where the corresponding user objects are not being marked as "present". The issue appears to be related to email addresses being stored in a different table, which was causing the `post_user.present?` check to return empty [Quintin_Par](/t/-/74154/1). [pfaffman](/t/-/74154/2) identified the problem and notified **gerhard** to review. [gerhard](/t/-/74154/5) has since fixed the issue with the Disqus import script in [commit 94ceb06b](https://github.com/discourse/discourse/commit/94ceb06b02fc32be4f3f7b6072fe1a7449edf674).

<div class="post-metadata">

**Author:** ![Quintin\_Par](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/quintin_par/32/120500_2.png) [@Quintin\_Par](https://meta.discourse.org/u/Quintin_Par)\
**Post date:** [November 16, 2017, 2:46am UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/1 "2017-11-16T02:46:14Z")

</div>

So I am trying to import a disqus commenting system

All of the topics get created but the corresponding comments are not. So I started digging around and realized the user object for the corresponding comment/post is not shown as “present” even though I can browse them from the forum.

The code in question is this

> <https://github.com/discourse/discourse/blob/5012d46cbd3bcf79b7351f7d2d41003496a796c5/script/import_scripts/disqus.rb#L80>

Before the import process started, I had disabled all outgoing emails. The script then created all these users (which I can verify)

But  
`post_user.present?`  
returns empty

Is this because the users are not active yet?

If yes, can I manually activate these users because they are part of an import and were already “active”

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [November 16, 2017, 5:04am UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/2 "2017-11-16T05:04:11Z")

</div>

I believe that the problem is that email addresses are now in a different table, and the code needs to be updated accordingly.

If I’m right, a bunch of importers will be broken similarly.

---

<div class="post-metadata">

**Author:** ![Quintin\_Par](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/quintin_par/32/120500_2.png) [@Quintin\_Par](https://meta.discourse.org/u/Quintin_Par)\
**Post date:** [November 16, 2017, 5:22am UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/3 "2017-11-16T05:22:07Z")

</div>

Thanks @pfaffman.

That’s bad news. Whom do you think can be tagged to raise concern? The whole importer side of the code has been moved from some other place and no history of owner.

By the way, shouldn’t this impact the user creation flow too?

> <https://github.com/discourse/discourse/blob/5012d46cbd3bcf79b7351f7d2d41003496a796c5/script/import_scripts/disqus.rb#L44>

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [November 16, 2017, 5:26am UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/4 "2017-11-16T05:26:16Z")

</div>

Hey, @gerhard. Does it look to you that the problem above is related to email addresses being moved to a different table?

> [@Quintin\_Par](#):
>
> By the way, shouldn’t this impact the user creation flow too?

No. The create\_user code still works and puts the email address in the correct table, but I think that some changes may need to be made to access the email address. It’s completely obvious, but only if you already know.

---

<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:** [November 16, 2017, 3:28pm UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/5 "2017-11-16T15:28:23Z")

</div>

Thanks for finding the root cause. The disqus import script was the only one with that problem. It should be fixed now.

[https://github.com/discourse/discourse/commit/94ceb06b02fc32be4f3f7b6072fe1a7449edf674](https://github.com/discourse/discourse/commit/94ceb06b02fc32be4f3f7b6072fe1a7449edf674)

---

<div class="post-metadata">

**Author:** ![Quintin\_Par](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/quintin_par/32/120500_2.png) [@Quintin\_Par](https://meta.discourse.org/u/Quintin_Par)\
**Post date:** [November 16, 2017, 3:33pm UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/6 "2017-11-16T15:33:21Z")

</div>

I am not a programmer and you’ve thanked me. I am on cloud nine. Thanks for all the work and for fixing this!

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/importing-comments-posts-are-not-getting-created-says-user-not-present-but-the-user-is-present/74154/7 "2024-06-08T12:43:51Z")

</div>

Closed on June 8, 2024, 12:43pm UTC

This topic was automatically closed after 2396 days. New replies are no longer allowed.
