learndash_quiz_email_admin

apply_filters( 'learndash_quiz_email_admin',  array $email_params,  WpProQuiz_Model_Quiz $quiz )

Filters quiz admin email parameters.


Description #


Parameters #

$email_params

(array) An array of quiz email parameters.

$quiz

(WpProQuiz_Model_Quiz) Quiz object.


Source #

File: includes/lib/wp-pro-quiz/lib/controller/WpProQuiz_Controller_Quiz.php


Examples #

 <?php
/**
 * Example usage for learndash_quiz_email_admin filter.
 */
add_filter(
	'learndash_quiz_email_admin',
	function( $email_params = array() ) {
		$globalMapper = new WpProQuiz_Model_GlobalSettingsMapper();
		$adminEmail   = $globalMapper->getEmailSettings();

		// If the email setting are using HTML we use WP to format the message.
		if ( ( isset( $adminEmail['html'] ) ) && ( $adminEmail['html'] ) ) {
			if ( ( isset( $email_params['msg'] ) ) && ( ! empty( $email_params['msg'] ) ) ) {
				$email_params['msg'] = wpautop( $email_params['msg'] );
			}
		}

		// Always return $email_params.
		return $email_params;
	},
	1
);