Hi,
i'm working on a functionality where new members get an email when they have been added to the system.
code so far:
class Patient extends Member {
private static $singular_name = "Patient";
public function onBeforeWrite() {
parent::onBeforeWrite();
$result = $this->checkPassword($this->Password);
$valid = $result->valid();
if ($result->valid()) {
return false;
} else {
$email = new Email();
$email->setTo($this->Email);
$email->setSubject($valid);
$email->setFrom('no_reply@mysite.com');
$email->setTemplate('AccesGranted');
$email->populateTemplate(array(
'Email' => $this->Email,
'Password' => $this->Password
));
$email->send();
}
}
}
I think the problem is that the checkpassword function returns nothing. Can someone point me in the right direction?
thanks in advance