fixed error in loop option email with _name

This commit is contained in:
asus
2024-04-03 14:07:25 +02:00
parent 913165a056
commit 8ac16dc1f4
3 changed files with 14 additions and 7 deletions

View File

@@ -171,7 +171,13 @@ function update_emails_settings_option_CIPF($request, $option_name, $option_data
//error_log("option_data bedore: " . json_encode($option_data)); //error_log("option_data bedore: " . json_encode($option_data));
foreach ($option_data as $email_type => $email_options) { foreach ($option_data as $email_type => $email_options) {
//error_log("email_type: " . $email_type); //error_log("email_type: " . $email_type);
$option_data[$email_type] = update_email_by_type_CIPF($email_type, $email_options, $request); if ($email_type === '_name') {
continue;
}
$ret_email = update_email_by_type_CIPF($email_type, $email_options, $request);
if ($ret_email !== false) {
$option_data[$email_type] = $ret_email;
}
} }
//error_log("option_data after : " . json_encode($option_data)); //error_log("option_data after : " . json_encode($option_data));
@@ -187,6 +193,10 @@ function update_emails_settings_option_CIPF($request, $option_name, $option_data
function update_email_by_type_CIPF($email_type, $email_options, $request) { function update_email_by_type_CIPF($email_type, $email_options, $request) {
Plgntls::debug_infos(); Plgntls::debug_infos();
//error_log("email type: " . $email_type); //error_log("email type: " . $email_type);
if ($email_type === '_name') {
return false;
}
/* /*
* set notification/confirmation_send to false by default, * set notification/confirmation_send to false by default,
* because the request only contains the value 'on' if checked, nothing for false * because the request only contains the value 'on' if checked, nothing for false

View File

@@ -39,6 +39,7 @@ function prepare_emails_CIPF($email_name, $user_id) {
} }
$user = get_user_by('id', $user_id); $user = get_user_by('id', $user_id);
$user_email = $user->user_email; $user_email = $user->user_email;
$headers = array('Content-Type: text/html; charset=UTF-8');
$emails_option = Plgntls::get_option_safe($emails_option_object); $emails_option = Plgntls::get_option_safe($emails_option_object);
@@ -57,7 +58,7 @@ function prepare_emails_CIPF($email_name, $user_id) {
$tmp_email['to'] = $email['notification_to']; $tmp_email['to'] = $email['notification_to'];
$tmp_email['subject'] = $email['notification_subject']; $tmp_email['subject'] = $email['notification_subject'];
$tmp_email['message'] = $email['notification_message']; $tmp_email['message'] = $email['notification_message'];
$tmp_email['headers'] = array('Content-Type: text/html; charset=UTF-8'); $tmp_email['headers'] = $headers;
$emails[] = $tmp_email; $emails[] = $tmp_email;
} }
if ($email['confirmation_send']) { if ($email['confirmation_send']) {
@@ -65,7 +66,7 @@ function prepare_emails_CIPF($email_name, $user_id) {
$tmp_email['to'] = $user_email; $tmp_email['to'] = $user_email;
$tmp_email['subject'] = $email['confirmation_subject']; $tmp_email['subject'] = $email['confirmation_subject'];
$tmp_email['message'] = $email['confirmation_message']; $tmp_email['message'] = $email['confirmation_message'];
$tmp_email['headers'] = array('Content-Type: text/html; charset=UTF-8'); $tmp_email['headers'] = $headers;
$emails[] = $tmp_email; $emails[] = $tmp_email;
} }
return $emails; return $emails;

View File

@@ -903,8 +903,6 @@ class Plgntls {
* *
*/ */
self::init_class(); self::init_class();
$toggle_menu = self::$_option_toggle_menu;
error_log("toggle menu: " . json_encode($toggle_menu));
if (empty($menu_options)) { if (empty($menu_options)) {
return; return;
@@ -959,7 +957,6 @@ error_log("toggle menu: " . json_encode($toggle_menu));
} }
private static function _toggle_menu($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback) { private static function _toggle_menu($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback) {
$toggle_menu = self::$_option_toggle_menu; $toggle_menu = self::$_option_toggle_menu;
error_log("toggle menu: " . json_encode($toggle_menu));
$toggle = self::get_option_safe($toggle_menu); $toggle = self::get_option_safe($toggle_menu);
@@ -978,7 +975,6 @@ error_log("toggle menu: " . json_encode($toggle_menu));
*/ */
private static function _add_link_to_plugin($links) { private static function _add_link_to_plugin($links) {
$option_toggle = self::$_option_toggle_menu; $option_toggle = self::$_option_toggle_menu;
error_log("toggle menu: " . json_encode($option_toggle));
$toggle = self::get_option_safe($option_toggle); $toggle = self::get_option_safe($option_toggle);
if (false === $toggle) { if (false === $toggle) {