public function filter_comment_post_redirect($location) { // page must be corrected due to available comment guestbook options // this is only required for cgb_comments and only if it is not a comment from another page (check by comparing 'is_cgb_comment' and 'comment_post_ID' POST values) if (isset($_POST['is_cgb_comment']) && $_POST['is_cgb_comment'] == $_POST['comment_post_ID']) { global $comment_id; require_once 'includes/comments-functions.php'; $cgb_func = CGB_Comments_Functions::get_instance(); $page = $cgb_func->get_page_of_comment($comment_id); $location = get_comment_link($comment_id, array('page' => $page)); } // add query for message after comment require_once CGB_PATH . 'includes/cmessage.php'; $cmessage = CGB_CMessage::get_instance(); $location = $cmessage->add_cmessage_indicator($location); return $location; }
<?php /** * The custom template for displaying Comments for comment-guestbook plugin. */ if (!defined('ABSPATH')) { exit; } require_once CGB_PATH . 'includes/options.php'; require_once CGB_PATH . 'includes/comments-functions.php'; $cgb_options = CGB_Options::get_instance(); $cgb_func = CGB_Comments_Functions::get_instance(); global $wp_query; $in_page = !isset($wp_query->comments); // Prepare $wp_query when template is displayed in post/page content if ($in_page) { $wp_query->comments = apply_filters('comments_array', $cgb_func->get_comments($wp_query->post->ID)); $wp_query->comment_count = count($wp_query->comments); } // Show comment incl comment forms if ('' === $cgb_options->get('cgb_clist_in_page_content') && !$in_page || '' !== $cgb_options->get('cgb_clist_in_page_content') && $in_page) { echo ' <div id="comments">'; // comment form above comments $cgb_func->show_comment_form_html('above_comments'); // is password required? if (post_password_required()) { echo ' <p class="nopassword">' . __('This post is password protected. Enter the password to view any comments.', $cgb_func->l10n_domain) . '</p> </div><!-- #comments -->'; return;
public function filter_comments_array($comments) { // Set correct comments list if the comments of all posts/pages should be displayed if ('' !== $this->options->get('cgb_clist_show_all')) { require_once CGB_PATH . 'includes/comments-functions.php'; $cgb_func = CGB_Comments_Functions::get_instance(); $comments = $cgb_func->get_comments(null); } // Invert array if clist order desc is required if ('desc' === $this->options->get('cgb_clist_order')) { $comments = array_reverse($comments); } return $comments; }