Wm_Tokens::parse_wm_token( $value,  $pieces,  $recipe_id,  $trigger_data, int $user_id,  $replace_args )


Parameters Parameters

$value

(Required)

$pieces

(Required)

$recipe_id

(Required)

$trigger_data

(Required)

$user_id

(int) (Required)

$replace_args

(Required)


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/wishlist-member/tokens/wm-tokens.php

	public function parse_wm_token( $value, $pieces, $recipe_id, $trigger_data, $user_id = 0, $replace_args ) {
		$tokens = [
			'WMMEMBERSHIPLEVELS',
		];

		if ( $pieces && isset( $pieces[2] ) ) {
			$meta_field = $pieces[2];

			if ( ! empty( $meta_field ) && in_array( $meta_field, $tokens ) ) {
				if ( $trigger_data ) {
					foreach ( $trigger_data as $trigger ) {
						switch ( $meta_field ) {
							case 'WMMEMBERSHIPLEVELS':
								$value = $trigger['meta']['WMMEMBERSHIPLEVELS_readable'];
								break;
						}
					}
				}
			}
		}

		return $value;
	}