| @@ -48,9 +48,17 @@ | ||
| 48 | 48 | $mailHeaders[] = "FROM: $headerFromName " . '<' . sanitize_email($fromMail[0]) . '>'; |
| 49 | 49 | $from_mail = $fromMail[0]; |
| 50 | 50 | } |
| 51 | 51 | (new MailConfig())->sendMail(['from_name' => $from_name, 'from_email' => $from_mail]); |
| 52 | - $mailSubject = FieldValueHandler::replaceFieldWithValue($mailTemplate[0]->sub, $fieldValue, $formID); | |
| 52 | + // Translate before smart-tag replacement. One language per submission, | |
| 53 | + // shared by the admin and submitter emails. | |
| 54 | + $mailSubjectTemplate = (string) apply_filters( | |
| 55 | + 'bitform_translate_form_string', | |
| 56 | + (string) $mailTemplate[0]->sub, | |
| 57 | + 'mail-sub-' . $mailTemplateID, | |
| 58 | + $formID | |
| 59 | + ); | |
| 60 | + $mailSubject = FieldValueHandler::replaceFieldWithValue($mailSubjectTemplate, $fieldValue, $formID); | |
| 53 | 61 | |
| 54 | 62 | // allow developers to modify email subject |
| 55 | 63 | $mailSubject = apply_filters( |
| 56 | 64 | 'bitform_filter_email_subject', |
| @@ -63,9 +71,14 @@ | ||
| 63 | 71 | 'is_double_optin' => (bool) $isDblOptin, |
| 64 | 72 | ] |
| 65 | 73 | ); |
| 66 | 74 | |
| 67 | - $mailBody = $mailTemplate[0]->body; | |
| 75 | + $mailBody = (string) apply_filters( | |
| 76 | + 'bitform_translate_form_string', | |
| 77 | + (string) $mailTemplate[0]->body, | |
| 78 | + 'mail-body-' . $mailTemplateID, | |
| 79 | + $formID | |
| 80 | + ); | |
| 68 | 81 | if (class_exists('\BitCode\BitFormPro\Admin\DownloadFile')) { |
| 69 | 82 | $downloadFile = new \BitCode\BitFormPro\Admin\DownloadFile(); |
| 70 | 83 | $mailBody = $downloadFile->replacePdfShortCodeToLink($mailBody, $formID, $entryID); |
| 71 | 84 | $mailBody = $downloadFile->replaceShortCodeToPdfPassword($mailBody, $formID, $entryID); |