Implement the email template into triggered notification as well.
Showing
1 changed file
with
60 additions
and
0 deletions
| ... | @@ -305,6 +305,66 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args = | ... | @@ -305,6 +305,66 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args = |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | // Do argument template again | ||
| 309 | // Set arguments for email template | ||
| 310 | $user_data = [ | ||
| 311 | 'prefix', | ||
| 312 | 'description', | ||
| 313 | 'date_of_birth', | ||
| 314 | 'title', | ||
| 315 | 'first_name', | ||
| 316 | 'initial', | ||
| 317 | 'last_name', | ||
| 318 | 'degrees', | ||
| 319 | 'designations', | ||
| 320 | 'company', | ||
| 321 | 'company_type', | ||
| 322 | 'home_address', | ||
| 323 | 'home_address2', | ||
| 324 | 'home_city', | ||
| 325 | 'home_province', | ||
| 326 | 'home_country', | ||
| 327 | 'home_postal', | ||
| 328 | 'home_phone', | ||
| 329 | 'home_mobile', | ||
| 330 | 'home_email', | ||
| 331 | 'work_address', | ||
| 332 | 'work_address2', | ||
| 333 | 'work_city', | ||
| 334 | 'work_province', | ||
| 335 | 'work_country', | ||
| 336 | 'work_postal', | ||
| 337 | 'work_phone', | ||
| 338 | 'work_extension', | ||
| 339 | 'work_fax', | ||
| 340 | 'work_email', | ||
| 341 | 'website', | ||
| 342 | 'preferred_language', | ||
| 343 | 'email_address_preference', | ||
| 344 | 'preferred_email', | ||
| 345 | 'member_id' | ||
| 346 | ]; | ||
| 347 | |||
| 348 | $user_data = array_flip($user_data); | ||
| 349 | |||
| 350 | foreach ($user_data as $field => $value) { | ||
| 351 | $user_data[$field] = User\clean_string(get_user_meta($uid, $field, true)); | ||
| 352 | |||
| 353 | if($field == 'preferred_email') { | ||
| 354 | $user_data['preferred_email'] = $user_data['email_address_preference'] == 'Home' ? $user_data['home_email'] : $user_data['work_email']; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 358 | foreach ($user_data as $key => $val) { | ||
| 359 | if ((filter_var($val, FILTER_VALIDATE_URL) !== false) && !empty($html)) { | ||
| 360 | $html = str_replace('{'.$key.'}', '<a href="'.$val.'">'.$val.'</a>', $html); | ||
| 361 | } else { | ||
| 362 | $html = str_replace('{'.$key.'}', $val, $html); | ||
| 363 | $altText = str_replace('{'.$key.'}', $val, $altText); | ||
| 364 | $subject = str_replace('{'.$key.'}', $val, $subject); | ||
| 365 | } | ||
| 366 | } | ||
| 367 | |||
| 308 | $attachments = isset($contents[$lang.'_attachments']) | 368 | $attachments = isset($contents[$lang.'_attachments']) |
| 309 | ? $contents[$lang.'_attachments'] | 369 | ? $contents[$lang.'_attachments'] |
| 310 | : $contents['en_attachments']; | 370 | : $contents['en_attachments']; | ... | ... |
-
Please register or sign in to post a comment