21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1169 Views |
-
Is there a way to send "New User" emails

30 April 2010 at 4:19am
I have searched the forum and docs and am unable to determine if the is a way to send a new user, added via the CMS security tab, their credentials when they are created. Has anyone done this or developed a solution?
Regards,
Todd M. Kimball -
Re: Is there a way to send "New User" emails

30 April 2010 at 7:56pm
I have not done this before, but I'd recommend using a custom/decorator Member class and adding the email sending in an overridden onAfterWrite.
-
Re: Is there a way to send "New User" emails

1 May 2010 at 12:53am Last edited: 1 May 2010 12:54am
Thanks, that did the trick. However, I'm getting 2 email notifications instead of one. I'm using this to decorate, test code no flame about not using the email class please 8):
<?php
class MemberEmailNotification extends DataObjectDecorator {function onAfterWrite() {
mail("me@email.com", "test", "did you get this?");parent::onAfterWrite();
}
}
?>Could this be a result of calling parent::onAfterWrite()? If I don't call it will I be omitting any necessary logic in the parent classes onAfterWrite method?
Regards,
Todd -
Re: Is there a way to send "New User" emails

1 May 2010 at 1:36am
Plan B, I'm attempting to use a native function of the Member class, sendInfo(), instead of writing my own logic to send an email. It works, but the email has variable symbols included instead of the values associated with the symbols. Here is a snippet of the email:
<--- Begin Snippet --->
Welcome, $FirstName.Thanks for signing up to become a new member, your details are listed below for future reference.
You can login to the website using the credentials listed below:
Email$Email
Password:$Password
Contact Information
<--- End Snippet --->As you can see, it's as if the variables aren't being parsed. Any ideas on this one?
Regards,
Todd -
Re: Is there a way to send "New User" emails

4 May 2010 at 8:46pm
how about doing something like this (again untested...)
class MemberEmailNotification extends DataObjectDecorator
{
var $bSendEmailFlag;function onAfterWrite()
{
parent::onBeforeWrite();
$this->bSendEmailFlag = true;
}function onAfterWrite()
{
parent::onAfterWrite();
if ($this->bSendEmailFlag)
{
mail("me@email.com", "test", "did you get this?");
$this->bSendEmailFlag = false;
}
}
} -
Re: Is there a way to send "New User" emails

7 May 2010 at 4:53am
Thanks again for the latest suggestion. However, I am now trying to use existing methods to generate the email (see my previous response). If anyone could provide any insight into the Member->sendInfo() method that wold be great.
Regards,
Todd -
Re: Is there a way to send "New User" emails

6 August 2010 at 9:08pm
I know I am replying to an old thread that you, toddmkimball, have moved on from, but I recently had a need to do this and since my method was untested I thought I'd post back the completed working version the way I found to work for a dataobject in general when creating it and ensuring you only get one execution of the code... note does not apply to re-saves...
function onAfterWrite()
{
parent::onAfterWrite();if (isset($this->Created))
{
//do on after wirte action only once
}
}Barry
| 1169 Views | ||
|
Page:
1
|
Go to Top |


