예제 #1
0
        static function review_check($item_id = null)
        {
            wp_reset_postdata();
            if (!$item_id) {
                return;
            }
            if (!is_user_logged_in() and st()->get_option('review_without_login') == "off") {
                return "must_login";
            }
            if (!self::comments_open($item_id)) {
                return "need_open";
            }
            if (self::check_reviewed($item_id) and st()->get_option('review_once') == "on") {
                return "reviewed";
            }
            if (st()->get_option('review_need_booked') == 'on') {
                $st_orders = new STOrder();
                $user_id = get_current_user_id();
                if (!$st_orders->check_user_booked2($user_id, $item_id)) {
                    return "need_booked";
                }
                if (!$st_orders->check_booked_date($item_id, $user_id)) {
                    return "wait_check_out_date";
                }
            }
            return "true";
        }
    }
    $a = new STReview();
    $a->init();
}