See the Rampart extra.
$user->get('username');
I'm almost sure that the OnUserActivate System Event is fired by the ConfirmRegister controller, so a plugin attached to that event could send the admin an email when the user is activated.
At that point, the username would be available with:
$user->get('username');
$message = 'Hi, a new User signed up: '.$hook->getValue('username') . ' with email '.$hook->getValue('email').'.'; $modx->getService('mail', 'mail.modPHPMailer'); $modx->mail->set(modMail::MAIL_BODY,$message); $modx->mail->set(modMail::MAIL_FROM,'[email protected]'); $modx->mail->set(modMail::MAIL_FROM_NAME,'PDF Match'); $modx->mail->set(modMail::MAIL_SENDER,'PDF Match'); $modx->mail->set(modMail::MAIL_SUBJECT,'New User Registration'); $modx->mail->address('to','[email protected]'); $modx->mail->setHTML(true); if (!$modx->mail->send()) { $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err); } $modx->mail->reset(); /* tell our snippet we're good and can continue */ return true;
$message = 'Hi, a new User signed up: '.$user->get('username'); $profile = $user->getOne('Profile'); if ($profile) { $message .= ' with email' . ' . $profile->get('email'); }
<?php $message = 'Hi, a new User signed up: '.$user->get('username'); $profile = $user->getOne('Profile'); if ($profile) { $message .= '' with email . ' . $profile->get('email'); } $modx->getService('mail', 'mail.modPHPMailer'); $modx->mail->set(modMail::MAIL_BODY,$message); $modx->mail->set(modMail::MAIL_FROM,'[email protected]'); $modx->mail->set(modMail::MAIL_FROM_NAME,'PDF Match'); $modx->mail->set(modMail::MAIL_SENDER,'PDF Match'); $modx->mail->set(modMail::MAIL_SUBJECT,'New User Registration'); $modx->mail->address('to','[email protected]'); $modx->mail->setHTML(true); if (!$modx->mail->send()) { $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err); } $modx->mail->reset(); /* tell our snippet we're good and can continue */ return true;