Forked from wpmudev-sls/wpmudev-forminator-quiz-personality-description-mail.php
Created
June 4, 2022 15:10
-
-
Save glaubersilva/52532495067fef5f6aaaa08ca7675bd0 to your computer and use it in GitHub Desktop.
[Forminator] Sends Quiz Personality Description by Email
This file contains hidden or 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] Sends Quiz Personality Description by Email | |
* Plugin URI: https://wpmudev.com/ | |
* Description: You need setup the {quiz_result_description} tag on the email body. | |
* Author: Glauber Silva @ WPMUDEV | |
* Author URI: https://wpmudev.com/ | |
* Task: SLS-2337 | |
* License: GPLv2 or later | |
* | |
* @package WPMUDEV_Forminator_Sends_Quiz_Personality_Description_by_Email | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
function wpmudev_forminator_sends_quiz_personality_description_by_email( $message, $quiz, $data ){ | |
if ( $quiz->quiz_type == 'nowrong' && isset( $data['entry'][0]['value']['result']['description'] ) ) { | |
$tag = '{quiz_result_description}'; | |
if ( strpos( $message, $tag ) !== false ) { | |
$desc = $data['entry'][0]['value']['result']['description']; | |
$message = str_replace( $tag, wp_strip_all_tags( $desc ), $message ); | |
} | |
} | |
return $message; | |
} | |
add_filter( 'forminator_quiz_mail_admin_message', 'wpmudev_forminator_sends_quiz_personality_description_by_email', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment