Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_USERCREATESPOST::store_tokens( $result,  $user_id,  $post,  $recipe_id,  $trigger_id )


Parameters Parameters

$result

(Required)

$user_id

(Required)

$post

(Required)

$recipe_id

(Required)

$trigger_id

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/wp/triggers/wp-usercreatespost.php

	private function store_tokens( $result, $user_id, $post, $recipe_id, $trigger_id ) {
		$trigger_meta = array(
			'user_id'        => $user_id,
			'trigger_id'     => $result['args']['trigger_id'],
			'trigger_log_id' => $result['args']['trigger_log_id'],
			'run_number'     => $result['args']['run_number'],
		);

		$prefix = $trigger_id . ':' . $this->trigger_code;

		// Post Title Token
		$trigger_meta['meta_key']   = $prefix . ':POSTTITLE';
		$trigger_meta['meta_value'] = maybe_serialize( $post->post_title );
		Automator()->insert_trigger_meta( $trigger_meta );

		// Post ID Token
		$trigger_meta['meta_key']   = $prefix . ':POSTID';
		$trigger_meta['meta_value'] = maybe_serialize( $post->ID );
		Automator()->insert_trigger_meta( $trigger_meta );

		// Post URL Token
		$trigger_meta['meta_key']   = $prefix . ':POSTURL';
		$trigger_meta['meta_value'] = maybe_serialize( get_permalink( $post->ID ) );
		Automator()->insert_trigger_meta( $trigger_meta );

		// Post Content Token
		$trigger_meta['meta_key']   = $prefix . ':POSTCONTENT';
		$trigger_meta['meta_value'] = maybe_serialize( $post->post_content );
		Automator()->insert_trigger_meta( $trigger_meta );

		// Post Excerpt Token
		$trigger_meta['meta_key']   = $prefix . ':POSTEXCERPT';
		$trigger_meta['meta_value'] = maybe_serialize( $post->post_excerpt );
		Automator()->insert_trigger_meta( $trigger_meta );

		// Post Type Token
		$trigger_meta['meta_key']   = $prefix . ':WPPOSTTYPES';
		$trigger_meta['meta_value'] = maybe_serialize( $post->post_type );
		Automator()->insert_trigger_meta( $trigger_meta );

		$trigger_meta['meta_key']   = $prefix . ':WPTAXONOMYTERM';
		$trigger_meta['meta_value'] = '';
		if ( isset( $this->terms_list[ $recipe_id ][ $trigger_id ] ) ) {
			$trigger_meta['meta_value'] = maybe_serialize( implode( ', ', $this->terms_list[ $recipe_id ][ $trigger_id ] ) );
		}
		Automator()->insert_trigger_meta( $trigger_meta );

		$trigger_meta['meta_key']   = $prefix . ':WPTAXONOMIES';
		$trigger_meta['meta_value'] = '';
		if ( isset( $this->taxonomy_list[ $recipe_id ][ $trigger_id ] ) ) {
			$trigger_meta['meta_value'] = maybe_serialize( implode( ', ', $this->taxonomy_list[ $recipe_id ][ $trigger_id ] ) );
		}
		Automator()->insert_trigger_meta( $trigger_meta );

		$this->trigger_meta_log = $trigger_meta;
		$this->result           = $result;

		if ( defined( 'REST_REQUEST' ) ) {
			add_action(
				"rest_after_insert_{$post->post_type}",
				array(
					$this,
					'store_thumbnail',
				),
				10,
				3
			);

			return;
		}
		$this->store_thumbnail( $post );
	}