PEEPSO_FOLLOWAUSER::follow_a_user( $user_id,  $action_data,  $recipe_id,  $args )

Validation function when the action is hit


Parameters Parameters

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)


Source Source

File: src/integrations/peepso/actions/peepso-followauser.php

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

		$follow_user_id = Automator()->parse->text( $action_data['meta'][ $this->action_meta ], $recipe_id, $user_id, $args );
		$userdata       = get_userdata( $follow_user_id );

		if ( ! $userdata ) {
			$error_message = __( "The user doesn't exist", 'uncanny-automator' );
			$recipe_log_id = $action_data['recipe_log_id'];
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_message, $recipe_log_id, $args );

			return;
		}

		$follow             = 1;
		$PeepSoUserFollower = new PeepSoUserFollower( $follow_user_id, $user_id, true );
		$PeepSoUserFollower->set( 'follow', $follow );

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