Hello,
i have memberprofiles installed, and everything works.. on the front-end users can add themselfs.. emails get send etc..
but when logged in as admin, you can't add members in the CMS any more!
This has got to do with the following code in MemberExtraStatistics.php
(this code extends Members and sends out the emails)
<?php
class MemberExtraStatistics extends DataObjectDecorator {
function onBeforeWrite() {
if (!$this->owner->exists()) {
$email = new Email();
$data = $this->owner->getAllFields();
$toAddress = Email::getAdminEmail();
$email->setTo($toAddress);
$email->setSubject('Member activation required');
$email->setFrom($data['Email']);
$email->setTemplate('EmailAccountActivation');
$email->populateTemplate($data);
$email->send();
}
}
The error in the CMS when adding a member:
[Notice] Undefined index: Email
POST /myproject/admin/security/EditForm/field/Members/AddForm?SecurityID=2a1cfb34e4d0bcef411795b803e31110a600d4dc
Line 315 in /home/myproject/public_html/myproject/mysite/code/MemberExtraStatistics.php
Line 315:
$email->setFrom($data['Email']);
I think this script is trying to use the admin email (logged-in account/email) instead of the email entered in the form in the CMS.
Is this correct? and how should i rewrite this?
Thanks in advance!