Thank you for your time BobRay. I pasted the code above into my ConfirmRegister controller and I got a few syntax errors. I did not add the user profile on top, because the username and notification should be sufficient. This was the original code:
public function process() {
$this->verifyManifest();
$this->getUser();
$this->validatePassword();
$this->onBeforeUserActivate();
/* activate user */
$this->user->set('active',1);
$this->user->set('cachepwd','');
if (!$this->user->save()) {
$this->modx->log(modX::LOG_LEVEL_ERROR,'[Register] Could not save activated user: '.$this->user->get('username'));
return '';
}
/* invoke OnUserActivate event */
$this->modx->invokeEvent('OnUserActivate',array(
'user' => &$this->user,
));
$this->addSessionContexts();
$this->redirectBack();
return '';
}
And this is the code after I pasted the coding you supplied:
public function process() {
$this->verifyManifest();
$this->getUser();
$this->validatePassword();
$this->onBeforeUserActivate();
/* activate user */
$this->user->set('active',0);
$this->user->set('cachepwd','');
if (!$this->user->save()) {
$this->modx->log(modX::LOG_LEVEL_ERROR,'[Register] Could not save activated user: '.$this->user->get('username'));
return '';
}
/* send email to admin - custom coding added */
$username = $user->get('username');
$adminEmail = '[email protected]';
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY, $username . ' has submitted the registration form');
$modx->mail->set(modMail::MAIL_FROM, $adminEmail);
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption('site_name');
$modx->mail->set(modMail::MAIL_SENDER, $adminEmail);
$modx->mail->set(modMail::MAIL_SUBJECT, 'New Registration);
$modx->mail->address('to', $to, $adminEmail);
$modx->mail->address('reply-to', $adminEmail);
$sent = $modx->mail->send();
/* invoke OnUserActivate event */
$this->modx->invokeEvent('OnUserActivate',array(
'user' => &$this->user,
));
$this->addSessionContexts();
$this->redirectBack();
return '';
}
According to Dreamweaver these lines are showing the red syntax errors:
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption('site_name');
$modx->mail->address('to', $to, $adminEmail);
$modx->mail->address('reply-to', $adminEmail);
The error I get is: "Dynamically-related files cannot be discovered because there is no site definition for this document". The errors flow all the way down the page. I have a suspicion I pasted in the wrong spot or a character is wrong. Any ideas?