Gamipress_Tokens::parse_token( $value,  $pieces,  $recipe_id,  $trigger_data,  $user_id,  $replace_args )

Parse the token as usual.


Return Return

(string) the value of the token.


Source Source

File: src/integrations/gamipress/tokens/gamipress-tokens.php

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

		$award_type = $trigger_data[0]['meta']['GPAWARDTYPES'] ?? '';

		$token = $pieces[2] ?? '';

		if ( ! empty( $token ) && ! empty( $award_type ) ) {

			if ( 'GPAWARDTYPES' === $token ) {
				$award_type = $trigger_data[0]['meta']['GPAWARDTYPES_readable'] ?? '';
				return $award_type;
			}
		}

		return $value;

	}