Wp_Tokens::parse_wproles_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/wp/tokens/wp-tokens.php

	public function parse_wproles_token( $value, $pieces, $recipe_id, $trigger_data, $user_id = 0, $replace_args ) {
		$piece = 'WPROLE';
		if ( $pieces ) {
			if ( in_array( $piece, $pieces ) ) {


				if ( $trigger_data ) {
					foreach ( $trigger_data as $trigger ) {
						global $wpdb;
						$meta_field = $trigger['ID'] . ':' . $pieces[1] . ':' . $pieces[2];
						$trigger_id = $trigger['ID'];
						$meta_value = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->prefix}uap_trigger_log_meta WHERE meta_key LIKE '%{$meta_field}%' AND automator_trigger_id = {$trigger_id} ORDER BY ID DESC LIMIT 0,1" );
						if ( ! empty( $meta_value ) ) {
							$value = maybe_unserialize( $meta_value );
						}
					}
				}
			}
		}

		return $value;
	}