events actions and email for profs are now well supported, without repeatitions
This commit is contained in:
@@ -28,7 +28,7 @@ if (!defined('ABSPATH')) {
|
||||
function prepare_emails_CIPF($email_name, $user_id) {
|
||||
Plgntls::debug_infos();
|
||||
$emails_option_object = Cipf::OPTION_EMAILS;
|
||||
|
||||
|
||||
if (!isset($emails_option_object['_default'][$email_name])) {
|
||||
return false;
|
||||
}
|
||||
@@ -59,12 +59,13 @@ function prepare_emails_CIPF($email_name, $user_id) {
|
||||
$tmp_email['message'] = $email['notification_message'];
|
||||
$tmp_email['headers'] = array();
|
||||
$tmp_email['headers'][] = $header_content_type;
|
||||
$tmp_email['headers'][] = 'User_id: '.$user_id;
|
||||
$from = $email['notification_from'];
|
||||
if (empty($from)) {
|
||||
$from = get_option('admin_email');
|
||||
}
|
||||
if (!empty($from)) {
|
||||
$tmp_email['headers'][] = 'From:'.$from;
|
||||
$tmp_email['headers'][] = 'From: '.$from;
|
||||
}
|
||||
$emails[] = $tmp_email;
|
||||
}
|
||||
@@ -75,12 +76,13 @@ function prepare_emails_CIPF($email_name, $user_id) {
|
||||
$tmp_email['message'] = $email['confirmation_message'];
|
||||
$tmp_email['headers'] = array();
|
||||
$tmp_email['headers'][] = $header_content_type;
|
||||
$tmp_email['headers'][] = 'User_id: '.$user_id;
|
||||
$from = $email['confirmation_from'];
|
||||
if (empty($from)) {
|
||||
$from = get_option('admin_email');
|
||||
}
|
||||
if (!empty($from)) {
|
||||
$tmp_email['headers'][] = 'From:'.$from;
|
||||
$tmp_email['headers'][] = 'From: '.$from;
|
||||
}
|
||||
$emails[] = $tmp_email;
|
||||
}
|
||||
@@ -93,12 +95,11 @@ function send_emails_CIPF($email_name, $user_id = null) {
|
||||
Plgntls::debug_infos();
|
||||
$emails = prepare_emails_CIPF($email_name, $user_id);
|
||||
if (false === $emails) {
|
||||
error_log('Email preparing failed!: ' . json_encode($emails));
|
||||
error_log('Email preparing failed!: ' . json_encode($email_name));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($emails as $email) {
|
||||
error_log('Email: ' . json_encode($email));
|
||||
$sent = wp_mail($email['to'], $email['subject'], $email['message'], $email['headers']);
|
||||
if (!$sent) {
|
||||
error_log('Email sending failed!: ' . json_encode($email));
|
||||
|
||||
Reference in New Issue
Block a user