public function ajaxDismiss() {
		if ( ! current_user_can( $this->userRole ) ) {
			wp_send_json_error( __( 'Permission denied.', 'boldgrid-library' ) );
		}

		if( ! check_ajax_referer( 'bglib-rating-prompt', 'security', false ) ) {
			wp_send_json_error( __( 'Invalid nonce.', 'boldgrid-library' ) );
		}

		$name          = sanitize_text_field( $_POST['name'] );
		$type          = sanitize_text_field( $_POST['type'] );
		$snooze_length = (int) $_POST['length'];

		switch( $type ) {
			case 'dismiss':
				$dismissed = $this->updatePromptKey( $name, 'time_dismissed', time() );
				$dismissed ? wp_send_json_success() : wp_send_json_error( __( 'Error dismissing prompt', 'boldgrid-library' ) );
				break;
			case 'snooze':
				$time_snoozed_set = $this->updatePromptKey( $name, 'time_snoozed', time() );
				$snoozed          = $this->updatePromptKey( $name, 'time_snoozed_until', time() + $snooze_length );
				$time_snoozed_set && $snoozed ? wp_send_json_success() : wp_send_json_error( __( 'Error snoozing prompt', 'boldgrid-library' ) );
				break;
			default:
				wp_send_json_error( __( 'Unknown action.', 'boldgrid-library' ) );
		}
	}
public function ajaxDismiss() {
		if ( ! current_user_can( $this->userRole ) ) {
			wp_send_json_error( __( 'Permission denied.', 'boldgrid-library' ) );
		}

		if( ! check_ajax_referer( 'bglib-rating-prompt', 'security', false ) ) {
			wp_send_json_error( __( 'Invalid nonce.', 'boldgrid-library' ) );
		}

		$name          = sanitize_text_field( $_POST['name'] );
		$type          = sanitize_text_field( $_POST['type'] );
		$snooze_length = (int) $_POST['length'];

		switch( $type ) {
			case 'dismiss':
				$dismissed = $this->updatePromptKey( $name, 'time_dismissed', time() );
				$dismissed ? wp_send_json_success() : wp_send_json_error( __( 'Error dismissing prompt', 'boldgrid-library' ) );
				break;
			case 'snooze':
				$time_snoozed_set = $this->updatePromptKey( $name, 'time_snoozed', time() );
				$snoozed          = $this->updatePromptKey( $name, 'time_snoozed_until', time() + $snooze_length );
				$time_snoozed_set && $snoozed ? wp_send_json_success() : wp_send_json_error( __( 'Error snoozing prompt', 'boldgrid-library' ) );
				break;
			default:
				wp_send_json_error( __( 'Unknown action.', 'boldgrid-library' ) );
		}
	}
public function ajaxDismiss ( ) { if ( ! current_user_can ( $ this -> userRole ) ) { wp_send_json_error ( __ ( 'Permission denied.' , 'boldgrid-library' ) ) ; } if ( ! check_ajax_referer ( 'bglib-rating-prompt' , 'security' , false ) ) { wp_send_json_error ( __ ( 'Invalid nonce.' , 'boldgrid-library' ) ) ; } $ name = sanitize_text_field ( $ _POST [ 'name' ] ) ; $ type = sanitize_text_field ( $ _POST [ 'type' ] ) ; $ snooze_length = ( int ) $ _POST [ 'length' ] ; switch ( $ type ) { case 'dismiss' : $ dismissed = $ this -> updatePromptKey ( $ name , 'time_dismissed' , time ( ) ) ; $ dismissed ? wp_send_json_success ( ) : wp_send_json_error ( __ ( 'Error dismissing prompt' , 'boldgrid-library' ) ) ; break ; case 'snooze' : $ time_snoozed_set = $ this -> updatePromptKey ( $ name , 'time_snoozed' , time ( ) ) ; $ snoozed = $ this -> updatePromptKey ( $ name , 'time_snoozed_until' , time ( ) + $ snooze_length ) ; $ time_snoozed_set && $ snoozed ? wp_send_json_success ( ) : wp_send_json_error ( __ ( 'Error snoozing prompt' , 'boldgrid-library' ) ) ; break ; default : wp_send_json_error ( __ ( 'Unknown action.' , 'boldgrid-library' ) ) ; } }
Dismiss a rating prompt via ajax.

@since 2.7.7

@hook wp_ajax_blib_rating_prompt_dismiss
Dismiss a rating prompt via ajax .