Last active
February 22, 2024 09:00
-
-
Save wpmudev-sls/d8da73be0993a0859996a4f912bce859 to your computer and use it in GitHub Desktop.
[Forminator Pro] - Fix email log issue in Microsoft Azure email logger plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: [Forminator Pro] Fix email log issue with Microsoft Azure email logging | |
* Description: Fix email log issue with Microsoft Azure email logging plugin. | |
* Author: Prashant @ WPMUDEV | |
* Task: SLS-5796 | |
* Author URI: https://premium.wpmudev.org | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly. | |
} | |
add_filter( 'wp_mail', 'wpmudev_azure_forminator_fixes', 10, 1 ); | |
function wpmudev_azure_forminator_fixes( $args ) { | |
if ( is_array( $args['headers'] ) ) { | |
foreach ( $args['headers'] as $key => $value ) { | |
if ( strpos( $value, 'X-FORMINAT-AZURE' ) !== false ) { | |
if ( is_array( $args['to'] ) ) { | |
$args['to'] = implode( ', ', $args['to'] ); | |
} | |
} | |
} | |
} | |
return $args; | |
} | |
add_filter( 'forminator_custom_form_mail_admin_headers', 'wpmudev_change_forminator_header_azure', 10, 5 ); | |
function wpmudev_change_forminator_header_azure( $headers, $custom_form, $data, $entry, $cls ) { | |
$headers[] = 'X-FORMINAT-AZURE : true'; | |
return $headers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment