TWITTER_POSTSTATUS_2::post_status( $user_id,  $action_data,  $recipe_id,  $args )

Action validation function.


Return Return

(mixed)


Source Source

File: src/integrations/twitter/actions/twitter-poststatus-2.php

	public function post_status( $user_id, $action_data, $recipe_id, $args ) {

		$status = Automator()->parse->text( $action_data['meta']['TWITTERSTATUSCONTENT'], $recipe_id, $user_id, $args );
		$media  = trim( Automator()->parse->text( $action_data['meta']['TWITTERSTATUSIMAGE'], $recipe_id, $user_id, $args ) );

		try {

			$media_id = '';

			if ( ! empty( $media ) ) {
				$media_id = $this->media_upload( $media );
			}

			$response = $this->statuses_update( $status, $media_id );

			Automator()->complete_action( $user_id, $action_data, $recipe_id );
			return;

		} catch ( \Exception $e ) {
			$error_msg                           = $e->getMessage();
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_msg );

			return;
		}

	}