function get_content_review($user_LK) { global $wpdb, $user_ID, $rcl_options; $online = 0; $otzivy = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . RCL_PREF . "profile_otziv WHERE user_id = '%d'", $user_LK)); if ($otzivy) { $recall_block = ''; foreach ($otzivy as $otziv) { if ($otziv->status > 0) { $status = 1; } else { if ($otziv->status < 0) { $status = '-1'; } else { $status = 0; } } $content = stripslashes_deep(esc_html($otziv->content_otziv)); $recall_block .= '<div class="public-post recall' . $status . '"> <div class="author-avatar">' . get_avatar($otziv->author_id, 60) . '</div> <div class="content-recall"> ' . $this->get_status($otziv->status) . ' <p> <strong><a href="' . get_author_posts_url($otziv->author_id) . '">' . get_the_author_meta('display_name', $otziv->author_id) . '</a> ' . __('leave a review', 'wp-recall') . ':</strong> </p>' . nl2br($content); if (function_exists('rcl_get_html_post_rating')) { $recall_block .= rcl_get_html_post_rating($otziv->ID, 'review-content', $otziv->author_id); } $recall_block .= '</div>'; if ($user_ID == $otziv->author_id) { $recall_block .= '<form method="post" action="" class="review-delete"> <input type="hidden" name="user_id" value="' . $otziv->user_id . '"> <input type="hidden" name="recall_id" value="' . $otziv->ID . '"> <input type="submit" class="recall-button" name="delete_review" value="' . __('Delete', 'wp-recall') . '"> </form>'; } $recall_block .= '</div>'; } } else { if ($user_ID == $user_LK) { $recall_block = '<p>' . __('You have not left any reviews', 'wp-recall') . '</p>'; } else { if ($user_ID != $user_LK) { $recall_block = '<h3>' . __('The user has no reviews yet', 'wp-recall') . '</h3>'; } } } //получаем кол-во отзывов текущего пользователя об авторе if ($user_ID != $user_LK && $user_ID) { $rt_limit = isset($rcl_options['rw_limit_rating']) && $rcl_options['rw_limit_rating'] ? $rcl_options['rw_limit_rating'] : 0; if ($rt_limit) { if (function_exists('rcl_get_user_rating')) { $rating = rcl_get_user_rating($user_ID); if ($rating < $rt_limit) { $notice = '<div class="notify-lk"><div class="warning">' . sprintf(__('Members with a value rating of less than %d can not leave a review.', 'wp-recall'), $rt_limit) . '</div></div>'; $notice .= $recall_block; return $notice; } } } if ($rcl_options['type_recall'] == 1) { $count_post_author = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM " . $wpdb->prefix . "posts WHERE post_author = '%d' AND post_status = 'publish' LIMIT 1", $user_ID)); $count_post_user = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM " . $wpdb->prefix . "posts WHERE post_author = '%d' AND post_status = 'publish' LIMIT 1", $user_LK)); if (!$count_post_author || !$count_post_user) { $notice = '<div class="notify-lk"><div class="warning">' . __('Users without published records cannot accept and add reviews.', 'wp-recall') . '</div></div>'; $notice .= $recall_block; return $block_wprecall; } } $user_ID_true = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM " . RCL_PREF . "profile_otziv WHERE user_id = '%d' AND author_id = '%d' LIMIT 1", $user_LK, $user_ID)); if ($user_ID_true == 0) { $addres_user = pow($user_LK, 2); $recall_form = '<div class="otziv"> <form name="addrecall" method="post" action=""> <p>' . __('Review text', 'wp-recall') . ':</p> <input type="radio" name="status" value="1" id="labeled_1" /><label for="labeled_1">' . __('Positively', 'wp-recall') . '</label> <input type="radio" name="status" value="0" id="labeled_2" checked="checked"/><label for="labeled_2">' . __('Neutral', 'wp-recall') . '</label> <input type="radio" name="status" value="-1" id="labeled_3" /><label for="labeled_3">' . __('Negatively', 'wp-recall') . '</label><br /> <label for="content_otz"></label> <textarea required name="content_otz" id="content_otz" rows="5" style="width:100%;padding:0;"></textarea> <input type="hidden" name="online" value="' . $online . '"> <input type="hidden" name="user_id" value="' . $addres_user . '"> <p style="text-align:right;"><input type="submit" name="add_review" class="recall-button" value="' . __('Add a review', 'wp-recall') . '"></p> </form> </div>'; $recall_block .= apply_filters('rcl_form_review', $recall_form); } } return $recall_block; }
function rcl_comment_content_rating($content) { global $comment; $content .= rcl_get_html_post_rating($comment->comment_ID, 'comment'); return $content; }