BDB_SETUSERSTATUS::set_user_status( $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)

$args

(Required)


Source Source

File: src/integrations/buddyboss/actions/bdb-setuserstatus.php

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

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

		if ( bp_is_active( 'moderation' ) ) {
			if ( 'suspend' === $set_user_status ) {
				\BP_Suspend_Member::suspend_user( $user_id );
			} elseif ( bp_moderation_is_user_suspended( $user_id ) ) {
				\BP_Suspend_Member::unsuspend_user( $user_id );
			}
			Automator()->complete->user->action( $user_id, $action_data, $recipe_id );
		} else {
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete->user->action( $user_id, $action_data, $recipe_id, __( 'To change members status in your network, please activate the Moderation component.' ) );
		}

	}