MYCRED_AWARDPOINTS_A::award_mycred_points( $user_id,  $action_data,  $recipe_id,  $args )

Validation function when the trigger action is hit


Parameters Parameters

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)


Source Source

File: src/integrations/mycred/actions/mycred-awardpoints-a.php

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

		$points_type = $action_data['meta'][ $this->action_meta ];

		$description = __( 'Awarded by Uncanny Automator', 'uncanny-automator-pro' );

		if ( ! empty( $action_data['meta']['MYCREDDESCRIPTION'] ) ) {
			$description = Automator()->parse->text( $action_data['meta']['MYCREDDESCRIPTION'], $recipe_id, $user_id, $args );
		}

		$points    = Automator()->parse->text( $action_data['meta']['MYCREDPOINTVALUE'], $recipe_id, $user_id, $args );
		$reference = Automator()->parse->text( $action_data['meta']['MYCREDPOINTS_readable'], $recipe_id, $user_id, $args );
		mycred_add( $reference, absint( $user_id ), $points, $description, '', '', $points_type );

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