Ut_Tokens::ut_utuserimported_possible_tokens( array $tokens = array(), array $args = array() )

Add tokens to the triggers


Parameters Parameters

$tokens

(Optional)

Default value: array()

$args

(Optional)

Default value: array()


Top ↑

Return Return

(array)


Source Source

File: src/integrations/uncanny-toolkit/tokens/ut-tokens.php

	public function ut_utuserimported_possible_tokens( $tokens = array(), $args = array() ) {
		if ( ! automator_do_identify_tokens() ) {
			return $tokens;
		}
		$trigger_meta = $args['meta'];
		$new_tokens   = array();
		foreach ( self::$user_import_tokens as $token_id => $token_name ) {
			$type = 'text';
			if ( 'user_email' === (string) $token_id ) {
				$type = 'email';
			}
			if ( 'user_id' === (string) $token_id ) {
				$type = 'int';
			}
			$new_tokens[] = array(
				'tokenId'         => $token_id,
				'tokenName'       => $token_name,
				'tokenType'       => $type,
				'tokenIdentifier' => $trigger_meta,
			);
		}
		$ld_tokens = array(
			'learndash_course_ids'    => __( 'Course ID(s)', 'uncanny-automator' ),
			'learndash_course_titles' => __( 'Course title(s)', 'uncanny-automator' ),
			'learndash_group_ids'     => __( 'Group ID(s)', 'uncanny-automator' ),
			'learndash_group_titles'  => __( 'Group title(s)', 'uncanny-automator' ),
		);
		if ( 'UTUSERIMPORTED' === $trigger_meta && defined( 'LEARNDASH_VERSION' ) ) {
			foreach ( $ld_tokens as $token_id => $token_name ) {
				$new_tokens[] = array(
					'tokenId'         => $token_id,
					'tokenName'       => $token_name,
					'tokenType'       => $type,
					'tokenIdentifier' => $trigger_meta,
				);
			}
		}

		return array_merge( $new_tokens, $tokens );
	}