Filter: wr_form_should_not_be_loaded

This filter can be used to hide a form and display a message instead of the form.

e.g. the user X is not allowed to see the form, because the developer dosen’t like the person. 

 

 

 

Example: Add fonts to pdf builder

add_action( 'wr_form_should_not_be_loaded', array( $this, 'hide_form_for_user_x' ), 10, 3 );

public function hide_form_for_user_x( array $flag_and_error_message, Form $form, Entry $entry ): array {
	if ( $form->get_identifier() === "identifier" && get_current_user_id() === 2) {
		$message = new HtmlObject( "div", array( "class" => "alert alert-warning" ),__( "You are not allowed to see this form", "your-text-domain" ) );
      		return array( true, $message );
	}

	return $flag_and_error_message;
}