Masterstudy_Tokens::masterstudy_token( string $value, array $pieces, string $recipe_id,  $trigger_data,  $user_id,  $replace_args )

Parse the token.


Parameters Parameters

$value

(string) (Required) .

$pieces

(array) (Required) .

$recipe_id

(string) (Required) .

$trigger_data

(Required)

$user_id

(Required)

$replace_args

(Required)


Top ↑

Return Return

(null|string)


Source Source

File: src/integrations/masterstudy-lms/tokens/masterstudy-tokens.php

	public function masterstudy_token( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) {

		if ( $pieces ) {
			if ( in_array( 'MSLMSQUIZ_SCORE', $pieces, true ) ) {
				global $wpdb;
				$trigger_id     = $pieces[0];
				$trigger_meta   = $pieces[2];
				$trigger_log_id = isset( $replace_args['trigger_log_id'] ) ? absint( $replace_args['trigger_log_id'] ) : 0;
				$entry          = $wpdb->get_var( "SELECT meta_value
													FROM {$wpdb->prefix}uap_trigger_log_meta
													WHERE meta_key = '$trigger_meta'
													AND automator_trigger_log_id = $trigger_log_id
													AND automator_trigger_id = $trigger_id
													LIMIT 0, 1" );
				$value          = $entry;
			}
		}

		return $value;
	}