846 Posts in 226 Topics by 249 members
Forum Module
SilverStripe Forums » Forum Module » Email notification for Forum registration
Discuss the Forum Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1371 Views |
-
Email notification for Forum registration

11 February 2010 at 6:12am
Hi!
I’ve been followed this thread (http://www.silverstripe.org/all-other-modules/show/277190) on comment notification. I’d like to implement something of this kind for new forum members; being informed of new registrations and validate them.
As the example given by Will uses a DataObjectDecorator and the register() function is in a Page_Controller (ForumMemberProfile), I guess the decorator cannot extend it, so I should decorate ForumRole or Member (since the former decorated de latter) with some onAfterwrite.
Could this work? (before I try by myself).
Best regards,
Juan -
Re: Email notification for Forum registration

12 February 2010 at 1:09am
I think you can’t decorate a Decorator (now that I think of it, it seems quite obvious…).
DataObject::add_extension('ForumRole', 'ForumMemberEmailNotification'); --> Breaks the site
DataObject::add_extension('Member', 'ForumMemberEmailNotification'); --> WorksI cannot call the parent function. Is it possible?
/mysite/code/ForumMemberEmailNotification.php
<?phpclass ForumMemberEmailNotification extends DataObjectDecorator {
function onAfterWrite() {
//$this->owner->onAfterWrite(); ////// I’ve tried a lot of things but they break the function
$email = new Email();
$email->setTemplate('NewMember');
$email->setTo('xxx@xxx.xx');
$email->setSubject('New Member');
$email->sendPlain();
}
}
?>/mysite/config.php
...
DataObject::add_extension('Member', 'ForumMemberEmailNotification');What can be wrong here? I have not forgotten to create the template. How can I debug Email()?
Thanks in advance for any insight,
Juan -
Re: Email notification for Forum registration

14 April 2010 at 11:11am
Juan, did you continue with this? Any progress or working code?
-
Re: Email notification for Forum registration

15 April 2010 at 12:17am
Hi!
I’ve been too busy. I modified the ForumMemberProfile function doregister() directly, but know I found here the correct syntax. I need to take a course on PHP.
So:
/mysite/code/ForumMemberEmailNotification.php
<?phpclass ForumMemberEmailNotification extends DataObjectDecorator {
function onAfterWrite() {
$email = new Email();
$email->setTemplate('NewMember');
$email->setTo('xxx@xxx.xx');
$email->setSubject('New Member');
$email->sendPlain();parent::onAfterWrite();
}
}
?>/mysite/config.php
...
DataObject::add_extension('Member', 'ForumMemberEmailNotification');Hope it helps,
Juan -
Re: Email notification for Forum registration

28 April 2010 at 4:39pm
Thanks, Juan, for the input.
Sooner or later I need that working. Currently other things are more urgent though. I still hope it'll get fixed by someone nice before it reaches the top of my "urgent" list ;)
| 1371 Views | ||
|
Page:
1
|
Go to Top |

