We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10208 ☆ A M B ☆
    • 1,780 Posts
    I need to transfer a db to a Revo install. The install is set up with the Subscribe package and is currently intaking new subscribers just fine.

    Future plan is to email users a newsletter, and also provide some custom pages in the front end. Nothing terribly special with permissions, which is also in place and working well.

    What I need to do is get the existing db into users, with usernames passwords of course. I don't really want to go so far as to ask these users to submit for opt in. I've spoken to many of them personally and received permission, the others opted in physically on paper in the past and more will be opting in on paper in the future. Opting out is always an option of course. The organization has mailed to all of these users physically in the past, they want to receive newsletters, but mail is expensive and the org needs to move to an email newsletter.

    How best to accomplish this?
      Frogabog- MODX Websites in Portland Oregon
      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
      Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • 32699 ☆ A M B ☆
      • 427 Posts
      If you can create a quick PHP Snippet, you could simply pull a collection from the Subscribe database data, and foreach the collection into a newObject modUser while using each object's set function to translate fields from Subscribe to the comparative modUser field.

      Check out the modUser class as for as functions to create passwords or other things you might need.

        Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

        Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
        • 10208 ☆ A M B ☆
        • 1,780 Posts
        It's not the subscribe database that I need to pull from, the data I need is actually in a MS Access db at the moment. Subscribe is creating users already. I need the external data.

        Not sure I could write that script properly yet anyway. :~{

          Frogabog- MODX Websites in Portland Oregon
          "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
          Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • 3749
          • 24,544 Posts
          Here is the code of the Register snippet:

          require_once $modx->getOption('login.core_path',null,$modx->getOption('core_path').'components/login/').'model/login/login.class.php';
          $login = new Login($modx,$scriptProperties);
          
          $controller = $login->loadController('Register');
          $output = $controller->run($scriptProperties);
          return $output;



          I think you could export the Access users to a CSV file, read that file and put the data into the $scriptProperties array, then use the code above to put the users into the DB and send them an email.

          Here are the relevant variables for $scriptProperties:

          array(
                      'activation' => true,
                      'activationEmail' => '',
                      'activationEmailSubject' => $this->modx->lexicon('register.activation_email_subject'),
                      'activationEmailTpl' => 'lgnActivateEmailTpl',
                      'activationEmailTplType' => 'modChunk',
                      'activationEmailTplAlt' => '',
                      'activationResourceId' => '',
                      'emailField' => 'email',
                      'errTpl' => '<span class="error">[[+error]]</span>',
                      'excludeExtended' => '',
                      'moderatedResourceId' => '',
                      'passwordField' => 'password',
                      'persistParams' => '',
                      'placeholderPrefix' => '',
                      'preHooks' => '',
                      'postHooks' => '',
                      'redirectBack' => '',
                      'redirectBackParams' => '',
                      'submittedResourceId' => '',
                      'submitVar' => 'login-register-btn',
                      'successMsg' => '',
                      'useExtended' => true,
                      'usergroups' => '',
                      'usernameField' => 'username',
                      'validate' => '',
                      'validatePassword' => true,
                  )


          I think you would have to put the email, username, and password, in $_POST variables named from the appropriate fields above.

          I'm not positive that it would work.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 27106
            • 147 Posts
              David Walker
              Principal, Shorewalker DMS
              Phone: 03 8899 7790
              Mobile: 0407 133 020
              • 3749
              • 24,544 Posts
              The problem is that the data in the CSV file could be in a lot of different formats, depending on where the user list is coming from. It might or might not have information on user groups and roles and the fields might or might not correspond to the fields in the MODX user and profile tables.

              That said, we should probably have an easy way to move Evo users to Revo. The problem with that is what to do about the passwords, since the Evo DB doesn't really contain the passwords and there's no way to get the passwords from the hash stored in the Evo DB.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting