How did you hear about us

I am trying to collect data from user on joining page. I have created new field block where he can select choices. Data is store fine in the database, but I can't find the way how to collect the data from database and send them to admin in email (New user ...... with email .......@hotmail.com has joined, his/her ID is 178).

I searched forum and found this: http://www.boonex.com/unity/forums/?action=goto&search=1#topic/How-to-modify-email-sent-to-site-admin.htm

but it seems to be not relevant to D 7.0.2.

If anybody had same issue, or knowledge on how to pull data from database and send them in email, help would be really appreciated.

Tahnks,

V.

Quote · 4 Sep 2010

2 changes need to be made to do that.

First a new key has to be added to the email template parser to get the new value from the database.

Open inc/classes/BxDolEmailTemplates.php

At about line 121 you need to add a new line to the parseContent function as shown in bold green below.

function parseContent($sContent, $aKeys, $iMemberId = 0) {
$aResultKeys = $this->aDefaultKeys;
if($iMemberId != 0) {
$aProfile = getProfileInfo($iMemberId);

$aResultKeys = array_merge($aResultKeys, array(
'recipientID' => $aProfile['ID'],
'RealName'    => $aProfile['NickName'],
'NickName'      => $aProfile['NickName'],
'Email'       => $aProfile['Email'],
'Password'    => $aProfile['Password'],
'SiteName'      => getParam('site_title'),
'MyNewTemplateKey'    => $aProfile['MyNewProfileField'],
));
}
if(is_array($aKeys))
$aResultKeys = array_merge($aResultKeys, $aKeys);

return $GLOBALS['oSysTemplate']->parseHtmlByContent($sContent, $aResultKeys, array('<', '>'));
}

MyNewTemplateKey is the key used in the template that will be replaced with the data when the template is parsed. Use whatever name you want to call the key here.

MyNewProfileField is the field in the database Profiles table that holds the data to be placed in the key. So use the name of the field as it appears in the database here.


Save file.

Now you need to edit the template.

Admin->Settings->Email Templates.

Edit the template Profile activation message template.There are 2 of them. The one to edit is the one that has a subject of New user joined

You would add a line to this template providing the key for your new data. Something like this.

Member heard about us from <MyNewTemplateKey>


Save the template. That should do it.


https://www.deanbassett.com
Quote · 4 Sep 2010

Thanks deano,

that worked excellent. Do you think this and much more could be done also with one of your Block modules?

Quote · 4 Sep 2010

Not this. No. PHP blocks allow you to create custom page blocks. For displaying information on the page for a member to view.

This required a source change. You would not have been able to do this with a block. If you could, i would have suggested it. I prefer not to do source changes unless i have to myself.



https://www.deanbassett.com
Quote · 4 Sep 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.