I am still aiming to put together a guideline on my experience with Login and using this plugin, just been super busy of late.
In the meantime below is some of my experience using Login (currenly on release 1.5.2)
I have followed all the instructions regarding setting up a registration page except as I didn’t want people to register automatically, so firstly I changed the response email to my own chunk. I used the following call on my registration page:
[[!Register? &submitVar=`registerbtn` &activationEmailTpl=`myRegistrationEmail` &activationEmailSubject=`Registration Submitted` &submittedResourceId=`17` &usergroups=`PrivateUserGroup` &postHooks=`hookNotifyAdminEmail` ]]
The custom chunk is myRegistrationEmail as follows:
<p>Hi, [[+username]],</p>
<p>Thanks for registering! Your application will be reviewed. On acceptance you will receive a confirmation email with details of where to login.</p>
<p>The password you registered was <strong>[[+password]]</strong> and your username is <strong>[[+username]]</strong>. Please keep these safe as you will require them when you are approved for login.</p>
<p>Kind regards,
<em>Site Administrator</em></p>
Instructions on the &postHooks=`hookNotifyAdminEmail` can be found in the Login documentation under Post Hooks. This allows notification to the Site Administrator that someone has registered on to site.
I then made use of the plugin the Bob provided using the following code:
<?php
if ($mode == modSystemEvent::MODE_UPD) {
if ( ! $user->get(’active’) && $_POST[’active’] ) {
$modx->logManagerAction(’activate_user’,’modUser’,$user->get(’id’));
$email = $_POST[’email’];
$name = $user->get(’username’);
$msg = "<p>Dear " . $name . ",</p>
<p>Thank you for registering at " . $modx->getOption(’site_name’,null,’My Site’) . ".</p>
<p>Your registration has been approved and you now access the Members area, please login <a href=’http://www.mywebsite.co.uk/login’>here</a>.</p>";
$msg .= "<p>Kind Regards,
Site Administrator</p>";
$subject = ’Registration Approved’;
$modx->getService(’mail’, ’mail.modPHPMailer’);
$modx->mail->set(modMail::MAIL_BODY, $msg);
$modx->mail->set(modMail::MAIL_FROM, $modx->getOption(’emailsender’));
$modx->mail->set(modMail::MAIL_FROM_NAME, $modx->getOption(’site_name’));
$modx->mail->set(modMail::MAIL_SENDER, $modx->getOption(’emailsender’));
$modx->mail->set(modMail::MAIL_SUBJECT, $subject);
$modx->mail->address(’to’, $email, $name);
$modx->mail->address(’no-reply-to’,’’);
$modx->mail->setHTML(true);
$sent = $modx->mail->send();
$modx->mail->reset();
}
}
I also selected under System Events onBeforeUserFormSave and everything works fine.
I am currently using Rev 2.0.4 as this site is being developed and will hopefully move this week to its own domain with Rev 2.0.6. I will test the manual activation again at that point and let you know if I experience any problems.
TIP: One thing I did find a little frustrating at first when using Login was that if I modified the chunks that came with the snippet any updates would overwrite my changes, so now I have created my own templates to prevent this from happening.