Custom tellfriend form Track referrals with Invite

Trying to customize the tellfriend.php form to include the friends name in the body of the email so it says, "Hello 'Friends Name' instead of just "Hello"
As shown in my screen shot, I am able to generate the input field on the form, but I am not sure of how to get it to appear in the salutation of the body of the email.  Oh, and it would be nice to make the pop up screen big enough to accommodate the new field I added.  Please help.

Also, I am trying to track the number of referrals members send out as a part of a membership drive. I thought that an easy way to do this would be to send a copy of the email to myself as an additional recipient.  I tried the following code to make a hidden field with my email and then include that in the sendmail function.  I get email fail message.  Maybe this is not the best way to get the information I want.  Basically I want a record of the invite including the sender's username and the friend's email.  It would be nice if I could make it an email notification so I can track member referrals.  Anny advice would be welcome and appreciated.  Thanks
I created the hidden field.
         'master_email' => array(
            'type' => 'hidden',
            'name' => 'master_email',
            'value' => ',info@mydomain.com'
        ), 
Then changed this line:
 $sRecipient   = clear_xss($_POST['friends_emails']);
To this:
    $sRecipient   = clear_xss($_POST['friends_emails' . 'master_email']);

invite friend form.JPG · 33.1K · 273 views
Even smart people do stupid things.
Quote · 24 Jan 2013

I still haven't figured this out. If anyone has any sugestions, please let me know.  By the way, I have no intention of sending any emails to the emails in the referral log.  I know that would be SPAM.  I also know that I can track refferred members who join just by putting a referred by field in the join form.  I want to give credit to my members for just telling their friends about my site.  I have not found a way to tally this so I can reward those members that invite others to join.

Even smart people do stupid things.
Quote · 6 Feb 2013

Add friends name,

if logged in members use Invite a friend, member avatar is also added to the email

(tested on Dol.7.1.0 - older versions, code may be some different)

1) open file tellfriend.php
add this code to the form, before 'friends_emails' => array(

 

'friends_name' => array(
            'type' => 'text',
            'name' => 'friends_name',
            'caption' => _t("_Friend name"),
            'value' => '',
            'checker' => array (
                'func' => 'length',
                'params' => array(3, 256),
                'error' => _t('_sys_adm_form_err_required_field'),
            ),
        ),

 

 

 

2) file tellfriend.php
add code with bold text

function SendTellFriend($iSenderID = 0)
{
    global $profileID;

    //Add members avatar else nothing
    if ($iSenderID <= 0){
             $Icon = '';
     }else{
           $Icon = '<img src=" '. BX_AVA_URL_USER_AVATARS . $iSenderID . BX_AVA_EXT .' ">';
     }

    //Add friends name
    $sRecipientName = clear_xss($_POST['friends_name']);

    $sRecipient   = clear_xss($_POST['friends_emails']);
    $sSenderName  = clear_xss($_POST['name']);
    $sSenderEmail = clear_xss($_POST['email']);
    if ( strlen( trim($sRecipient) ) <= 0 )
        return 0;
    if ( strlen( trim($sSenderEmail) ) <= 0 )
        return 0;

    $sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : '';
    $rEmailTemplate = new BxDolEmailTemplates();
    if ( $profileID ) {
        $aTemplate = $rEmailTemplate -> getTemplate( 't_TellFriendProfile', $profileID ) ;
        $Link = getProfileLink($profileID, $sLinkAdd);
    } else {
        $aTemplate = $rEmailTemplate -> getTemplate( 't_TellFriend' ) ;
        $Link = BX_DOL_URL_ROOT;
        if (strlen($sLinkAdd) > 0)
            $Link .= '?' . $sLinkAdd;
    }
    $aPlus = array(
        'Link' => $Link,
        'FromName' => $sSenderName,
        //Add friends name and members avatar
        'ToName' => $sRecipientName,
        'Icon' => $Icon,
    );
    return sendMail($sRecipient, $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus);

}


3) administration -> Settings -> Email Templates -> Friend Invitation
added code is bold

<bx_include_auto:_email_header.html />
<p>Hi <ToName></p>
<p>I thought you'd be interested: <a href="<Link>"><Link></a><br />
</p>
<Icon> <FromName>
<bx_include_auto:_email_footer.html />

Quote · 9 Feb 2013

Thank you okweb.  I will give that a try.  Will your suggested code also adjust the tellfriend window size so that all fields will be displayed?

Even smart people do stupid things.
Quote · 10 Feb 2013

You can do it here
(as always clean cache to be sure)

inc/js/functions.js

function launchTellFriend() {
    var sBaseUrl = document.getElementsByTagName('base')[0].href;
   
    var win = 'width=380,height=270,left=200,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=no,scrollbars=no';
    return !window.open(sBaseUrl + 'tellfriend.php', 'tellfriend', win);
}

Quote · 10 Feb 2013
 
 
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.