We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44109
    • 12 Posts
    I am using evo 1.0.10 and the need is to create new users using the API (only username and password, no e-mail needed).
    For the login process I use the WebloginPe.

    I have tried to insert records into modx_web_users, but it does not seem to be enough for logging in.
    Searching the internet for better solutions I found the call
    $modx->newObject('modUser');
    but evo does not seem to recognize it?
    Since I am quite new to modx could someone point me to the right direction?

    Thank you in advance
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Evo handles this quite differently from Revo; the method you mention is for Revo.

      As far as I recall, to create users in Evo you just directly access the database to insert first into the web_users table, get the new user ID and use it as the internalKey value for the web_user_settings table and the user_groups table. You will need an email to get the created users to display properly in the Manager, though. The email doesn't need to be a real one, you can use a common dummy email. Be careful to test for duplicate usernames in your code.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 44109
        • 12 Posts
        Thank you very much for your prompt reply.
        I will do as you suggest, if I have any difficulties I will post them in this thread.
          • 44109
          • 12 Posts
          Inserting into web_users, web_user_attributes and user_groups worked perfectly.
            • 36416
            • 589 Posts
            Quote from: sottwell at Nov 26, 2013, 11:48 AM
            Evo handles this quite differently from Revo; the method you mention is for Revo.
            As far as I recall, to create users in Evo you just directly access the database to insert first into the web_users table, get the new user ID and use it as the internalKey value for the web_user_settings table and the user_groups table. You will need an email to get the created users to display properly in the Manager, though. The email doesn't need to be a real one, you can use a common dummy email. Be careful to test for duplicate usernames in your code.

            There's a recent library by AgelxNash simplifying that:
            https://github.com/AgelxNash/resourse/blob/MODxAPI/modUsers.php

            ...and slowly getting into the official Evolution distribution:
            https://github.com/modxcms/evolution/commit/16dd42b9bcde0fc0ca4f17d6d7ef0b8c83bf96f1#diff-1