<?php



namespace Elex\MultiVendor\Model;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

class Reviews {

	public function add_comment( $parent_id, $comment_content, $comment_post_id ) {

		$data = array();

		$user_data = wp_get_current_user();

		$data['comment_author']       = $user_data->user_login;
		$data['comment_author_email'] = $user_data->user_email;
		$data['comment_author_url']   = $user_data->user_url;
		$data['comment_content']      = $comment_content;
		$data['comment_parent']       = $parent_id;
		$data['comment_post_ID']      = $comment_post_id;
		$data['user_id']              = $user_data->ID;

		$id = wp_new_comment( $data );

		return $id;
	}

	public function edit_comment( $comment_id, $comment_content ) {

		$data = array();

		$data['comment_ID']      = $comment_id;
		$data['comment_content'] = $comment_content;

		$id = wp_update_comment( $data );

		return $id;
	}

	public function delete_comment( $comment_id ) {
		$val = wp_delete_comment( $comment_id );
		return $val;
	}
}
