Hello, I am embarking on yet another project. I want to sell digital goods and automate a new user registration which ends with an email to the new user containing user name and password and some documentation.
It seems to me this isn't a novel task, is there a tool or framework for this already?
Anyway, I have been researching and found an old post with code from BobRay, just some simple php:
$user = $modx->newObject('modUser', array ('username'=>'MyUser'));
$user->set('password',md5('somePassword'));
$userProfile = $modx->newObject('modUserProfile');
$userProfile->set('fullname','My User');
$userProfile->set('email','
[email protected]');
$success = $user->addOne($userProfile);
if ($success) {
$user->save();
return '<p>User object and profile created</p>';
} else {
return '<p>failed to add profile. User not saved.</p>';
}
And I would just need to have success lead to the email going out, and to put in the new user's email value into the code.
Then, I just need a system event as trigger, and boom the tool fires every time!
Or so it goes, in my mind lol...
Any advice appreciated!