Product_Review_Handler::remove_form_messages_from_post_content( bool $show, int $post_id )

Summary

Do not show product review form error/success messages above the post content. They will be rendered with the form.


Parameters

$show

(bool) (Required)

$post_id

(int) (Required)


Return

(bool)


Source

File: src/BigCommerce/Forms/Product_Review_Handler.php

	public function remove_form_messages_from_post_content( $show, $post_id ) {
		$data       = [];
		$bc_error   = filter_var_array( $_REQUEST, [ Error_Handler::PARAM => FILTER_SANITIZE_STRING ] );
		$bc_success = filter_var_array( $_REQUEST, [ Success_Handler::PARAM => FILTER_SANITIZE_STRING ] );

		if ( $bc_error[ Error_Handler::PARAM ] ) {
			$data = get_transient( $bc_error[ Error_Handler::PARAM ] );
		} elseif ( $bc_success[ Success_Handler::PARAM ] ) {
			$data = get_transient( $bc_success[ Success_Handler::PARAM ] );
		}

		if ( $data && array_key_exists( 'submission', $data ) ) {
			if ( array_key_exists( 'bc-action', $data['submission'] ) ) {
				if ( $data['submission']['bc-action'] == self::ACTION ) {
					return false;
				}
			}
		}

		return $show;
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.