Custom Email Template

Hello Everyone,

Im having a slight problem with adding email template keys ive successfully added a custom key using the instructions posted here: http://www.boonex.com/forums/topic/Email-Template-Keys-How-to-add-a-new-one.html but the problem is that its showing the information of the user who received the message and not the sender.

For example if someone sends a greeting to someone else and lets say i want to add the date of birth of the sender in the greetings email it will show the receivers date of birth and not the sender but i want it to show the senders date of birth

Thank you any help will be greatly appreciated.

Quote · 18 Jun 2014

The url to the topic you referenced is wrong.

But anyway. Post the code you used to obtain the information you wanted.


The function pointed out in that topic all reference the recipient ID and not the sender. So it does not come as a surprise. The problem is the sender id is not always known. There are ways to obtain it, but it will only work for templates that are used when a member is logged in. Templates that are processed and sent while a member is offline such as those processed by a cron job such as Match notifications, or subscription change or expire notifications. Those are sent by the system, so have no sender id to pull info from.

It also will require much more work, more changes to other functions other than that one. The sender id has to be determined ahead of time before the function is even called and the then passed to that function which will result in more source changes. How many i do not know. It will take time to figure it all out.

https://www.deanbassett.com
Quote · 18 Jun 2014

Thanks for the reply the code that i edited is from BxDolEmailTemplates.php line 121:

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'],

'EmailWalleeWakil'    => $$aRecipientInfo['EmailWalleeWakil'],

'EmailWakil'    => $aProfile['EmailWakil'],

                'SiteName' => getParam('site_title'),

            ));

I added the parts which say emailwalleewakil & emailwakil the only way it works is if it says $$aRecipientInfo ive tried to change it to senderinfo but that doesn't seem to work but i want it to show the senders 'emailwakil' which is a field they entered in their profile

Thanks for the help

Quote · 20 Jun 2014

Should not work at all.

'EmailWalleeWakil'    => $$aRecipientInfo['EmailWalleeWakil'],

Error one. two $$. That is invalid php code and i am actually supprized it does not generate a error.

Problem 2. $aRecipientInfo is not within the scope of the parseContent function so should be empty. So again i cannot possibly see how that would work either.

You cannot access the sender info from inside that function. Only recipient info is available.

What needs to be done is to pass the info that is to be put into the template as part of the aKeys array. To do that, the function that calls the template has to be changed, not the function that processes the template. Thus before we can help we need to know which template is being modified to use the new keys. The proper source function needs to be changed at the proper location so you have access to the sender data and not the receiver data.

https://www.deanbassett.com
Quote · 20 Jun 2014

The email template that im trying to modify is the ' Greeting from the other member notification letter template. '

Thanks

Quote · 21 Jun 2014

Anybody?

Quote · 25 Jun 2014
 
 
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.