src/controller/admin/class-rating.php
public function restart_all_ratings() {

		$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';

		if ( ! wp_verify_nonce( $nonce, 'eliasis' ) && ! wp_verify_nonce( $nonce, 'customRatingGrifusAdmin' ) ) {
			die( 'Busted!' );
		}

		$response['ratings_restarted'] = 0;

		$posts = $this->model->get_posts();

		foreach ( $posts as $post ) {
			if ( isset( $post->ID ) && ! $this->model->get_movie_votes( $post->ID ) ) {
				$this->set_rating_and_votes(
					$post->ID,
					$this->get_default_votes( $post->ID )
				);
				$response['ratings_restarted']++;
			}
		}

		echo json_encode( $response );

		die();
	}
public function restart_all_ratings() {

		$nonce = isset( $_POST['nonce'] ) ? $_POST['nonce'] : '';

		if ( ! wp_verify_nonce( $nonce, 'eliasis' ) && ! wp_verify_nonce( $nonce, 'customRatingGrifusAdmin' ) ) {
			die( 'Busted!' );
		}

		$response['ratings_restarted'] = 0;

		$posts = $this->model->get_posts();

		foreach ( $posts as $post ) {
			if ( isset( $post->ID ) && ! $this->model->get_movie_votes( $post->ID ) ) {
				$this->set_rating_and_votes(
					$post->ID,
					$this->get_default_votes( $post->ID )
				);
				$response['ratings_restarted']++;
			}
		}

		echo json_encode( $response );

		die();
	}
public function restart_all_ratings ( ) { $ nonce = isset ( $ _POST [ 'nonce' ] ) ? $ _POST [ 'nonce' ] : '' ; if ( ! wp_verify_nonce ( $ nonce , 'eliasis' ) && ! wp_verify_nonce ( $ nonce , 'customRatingGrifusAdmin' ) ) { die ( 'Busted!' ) ; } $ response [ 'ratings_restarted' ] = 0 ; $ posts = $ this -> model -> get_posts ( ) ; foreach ( $ posts as $ post ) { if ( isset ( $ post -> ID ) && ! $ this -> model -> get_movie_votes ( $ post -> ID ) ) { $ this -> set_rating_and_votes ( $ post -> ID , $ this -> get_default_votes ( $ post -> ID ) ) ; $ response [ 'ratings_restarted' ] ++ ; } } echo json_encode ( $ response ) ; die ( ) ; }
Restart all ratings.
Restart all ratings .