Skip to content

Commit

Permalink
Disable sending from logged in contact ID / user email for 'Tell a Fr…
Browse files Browse the repository at this point in the history
…iend'
  • Loading branch information
mattwire committed Jan 12, 2018
1 parent b74f7a4 commit 0df107f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions CRM/Friend/BAO/Friend.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,14 @@ public static function create(&$params) {
$mailParams['module'] = 'event';
}
elseif ($params['entity_table'] == 'civicrm_pcp') {
$mailParams['email_from'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $params['source_contact_id'],
'email', 'contact_id'
);
if (Civi::settings()->get('allow_mail_from_logged_in_contact')) {
$mailParams['email_from'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $params['source_contact_id'],
'email', 'contact_id'
);
}
else {
$mailParams['email_from'] = $domainDetails['1'];
}
$urlPath = 'civicrm/pcp/info';
$mailParams['module'] = 'contribute';
}
Expand Down Expand Up @@ -297,9 +302,11 @@ public static function sendMail($contactID, &$values) {
$fromName = $email;
}

// use contact email, CRM-4963
if (empty($values['email_from'])) {
$values['email_from'] = $email;
if (Civi::settings()->get('allow_mail_from_logged_in_contact')) {
// use contact email, CRM-4963
if (empty($values['email_from'])) {
$values['email_from'] = $email;
}
}

foreach ($values['email'] as $displayName => $emailTo) {
Expand Down

0 comments on commit 0df107f

Please sign in to comment.