• Login
  • Register

DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Adding User Via SQL | Updating User ID

You are not authorized to post a reply.

New Member

New Member

    Hi all,
    All users from my websites had been permanently deleted, these users had a re-occuring payment via paypal. Each Payment would send a notification to the website, extending a expiry date for the subscription role on that user. The Unique identifier is the "UserID".

    Once a user is deleted the UserID is gone. I can create a user via SQL scipt below - I then update DBO.profile, DBO.userprofile, DBO.Userportal,DBO.Userroles. - which shows the profile in DNN. But when I try to login to a user - i'm having password Issues. Any help is much appricated!!!!

    INSERT INTO dbo.Users (UserID, Username, FirstName, LastName, IsSuperUser, AffiliateId, Email, DisplayName, UpdatePassword, LastIPAddress, IsDeleted, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate, PasswordResetToken, PasswordResetExpiration)
    VALUES ( 01, '[email protected]', 'name', 'name', 0, NULL, '[email protected]', 'Name', 0, NULL, 0, 1, NULL, 1, NULL, NULL, NULL);Go


    How do I set a password or send a password reset link for a user created via SQL? Is there another table i am missing?

    Veteran Member

    Veteran Member

      this is not an easy task, anyway, it should be possible.
      A while ago I created an SQL script that generates 999 users for testing purposes (GitHub - MaiklT/GenerateDNNTestUsers: An SQL script to create 999 Test Users for DNN), have a look at it, it should give you the idea.

      To create a password (I used the same for all users), you have to create a user the "normal" way and use the password hash and salt in the aspnet_membership table.

      Don't forget to restart the application pool when you're done - and I would strongly recommend to try this in a testing environment (copy of your web site) before you do it in production. And always create a backup before you do it, in the testing environment as well as in the production environment.

      Happy DNNing!


      Michael Tobisch

      dnnWerk Austria
      DNN Connect

      Veteran Member

      Veteran Member

        please be aware, creating user records is complex, besides DNN tables, you need to populate records in the aspnet membership and users table as well. Therefore you should stay away from creating user records manually in the database. you might use DNN Prompt to create users manually in DNN (see https://dnndocs.com/content/features/tools-utilities/prompt/index.html)
        You are not authorized to post a reply.

        These Forums are dedicated to discussion of DNN Platform.

        For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

        1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
        2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
        3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
        4. No Flaming or Trolling.
        5. No Profanity, Racism, or Prejudice.
        6. Site Moderators have the final word on approving / removing a thread or post or comment.
        7. English language posting only, please.

        Would you like to help us?

        Awesome! Simply post in the forums using the link below and we'll get you started.

        Get Involved