PHP Класс WC_Comments

Handle comments (reviews and order notes)
Автор: WooThemes
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
add_avatar_for_review_comment_type ( array $comment_types ) : array Make sure WP displays avatars for comments with the review type.
add_comment_purchase_verification ( integer $comment_id ) : boolean Determine if a review is from a verified owner at submission.
add_comment_rating ( integer $comment_id ) Rating field for comments.
check_comment_rating ( array $comment_data ) : array Validate the comment ratings.
clear_transients ( integer $post_id ) Ensure product average rating and review count is kept up to date.
comment_moderation_recipients ( array $emails, integer $comment_id ) : array Modify recipient of review email.
delete_comments_count_cache ( ) : void Delete comments count cache whenever there is new comment or the status of a comment changes. Cache will be regenerated next time WC_Comments::wp_count_comments() is called.
exclude_order_comments ( array $clauses ) : array Exclude order comments from queries and RSS.
exclude_order_comments_from_feed_join ( string $join ) : string Exclude order comments from queries and RSS.
exclude_order_comments_from_feed_where ( string $where ) : string Exclude order comments from queries and RSS.
exclude_webhook_comments ( array $clauses ) : array Exclude webhook comments from queries and RSS.
exclude_webhook_comments_from_feed_join ( string $join ) : string Exclude webhook comments from queries and RSS.
exclude_webhook_comments_from_feed_where ( string $where ) : string Exclude webhook comments from queries and RSS.
get_average_rating_for_product ( WC_Product &$product ) : float Get product rating for a product. Please note this is not cached.
get_rating_counts_for_product ( WC_Product &$product ) : array Get product rating count for a product. Please note this is not cached.
get_review_count_for_product ( WC_Product &$product ) : integer Get product review count for a product (not replies). Please note this is not cached.
init ( ) Hook in methods.
wp_count_comments ( object $stats, integer $post_id ) : object Remove order notes and webhook delivery logs from wp_count_comments().

Описание методов

add_avatar_for_review_comment_type() публичный статический Метод

Make sure WP displays avatars for comments with the review type.
С версии: 2.3
public static add_avatar_for_review_comment_type ( array $comment_types ) : array
$comment_types array
Результат array

add_comment_purchase_verification() публичный статический Метод

Determine if a review is from a verified owner at submission.
public static add_comment_purchase_verification ( integer $comment_id ) : boolean
$comment_id integer
Результат boolean

add_comment_rating() публичный статический Метод

Rating field for comments.
public static add_comment_rating ( integer $comment_id )
$comment_id integer

check_comment_rating() публичный статический Метод

Validate the comment ratings.
public static check_comment_rating ( array $comment_data ) : array
$comment_data array
Результат array

clear_transients() публичный статический Метод

Ensure product average rating and review count is kept up to date.
public static clear_transients ( integer $post_id )
$post_id integer

comment_moderation_recipients() публичный статический Метод

Modify recipient of review email.
public static comment_moderation_recipients ( array $emails, integer $comment_id ) : array
$emails array
$comment_id integer
Результат array

delete_comments_count_cache() публичный статический Метод

Delete comments count cache whenever there is new comment or the status of a comment changes. Cache will be regenerated next time WC_Comments::wp_count_comments() is called.
public static delete_comments_count_cache ( ) : void
Результат void

exclude_order_comments() публичный статический Метод

This code should exclude shop_order comments from queries. Some queries (like the recent comments widget on the dashboard) are hardcoded. and are not filtered, however, the code current_user_can( 'read_post', $comment->comment_post_ID ) should keep them safe since only admin and. shop managers can view orders anyway. The frontend view order pages get around this filter by using remove_filter('comments_clauses', array( 'WC_Comments' ,'exclude_order_comments'), 10, 1 );
public static exclude_order_comments ( array $clauses ) : array
$clauses array
Результат array

exclude_order_comments_from_feed_join() публичный статический Метод

Exclude order comments from queries and RSS.
public static exclude_order_comments_from_feed_join ( string $join ) : string
$join string
Результат string

exclude_order_comments_from_feed_where() публичный статический Метод

Exclude order comments from queries and RSS.
public static exclude_order_comments_from_feed_where ( string $where ) : string
$where string
Результат string

exclude_webhook_comments() публичный статический Метод

Exclude webhook comments from queries and RSS.
С версии: 2.2
public static exclude_webhook_comments ( array $clauses ) : array
$clauses array
Результат array

exclude_webhook_comments_from_feed_join() публичный статический Метод

Exclude webhook comments from queries and RSS.
С версии: 2.2
public static exclude_webhook_comments_from_feed_join ( string $join ) : string
$join string
Результат string

exclude_webhook_comments_from_feed_where() публичный статический Метод

Exclude webhook comments from queries and RSS.
С версии: 2.1
public static exclude_webhook_comments_from_feed_where ( string $where ) : string
$where string
Результат string

get_average_rating_for_product() публичный статический Метод

Get product rating for a product. Please note this is not cached.
С версии: 2.7.0
public static get_average_rating_for_product ( WC_Product &$product ) : float
$product WC_Product
Результат float

get_rating_counts_for_product() публичный статический Метод

Get product rating count for a product. Please note this is not cached.
С версии: 2.7.0
public static get_rating_counts_for_product ( WC_Product &$product ) : array
$product WC_Product
Результат array of integers

get_review_count_for_product() публичный статический Метод

Get product review count for a product (not replies). Please note this is not cached.
С версии: 2.7.0
public static get_review_count_for_product ( WC_Product &$product ) : integer
$product WC_Product
Результат integer

init() публичный статический Метод

Hook in methods.
public static init ( )

wp_count_comments() публичный статический Метод

Remove order notes and webhook delivery logs from wp_count_comments().
С версии: 2.2
public static wp_count_comments ( object $stats, integer $post_id ) : object
$stats object Comment stats.
$post_id integer Post ID.
Результат object