Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/18/2018 06:06:16 PM (6 years ago)
Author:
johnjamesjacoby
Message:

Metaboxes: show non-public replies in topic-replies meta/list box.

This shows trashed/spam replies to capable users when editing a topic via WordPress admin, because if you're moderating a topic from here, chances are high you want to see everything - not just public replies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/classes/class-bbp-topic-replies-list-table.php

    r6769 r6770  
    200200        $orderby      = ! empty( $_REQUEST['orderby'] ) ? sanitize_key( $_REQUEST['orderby'] ) : 'date';
    201201        $order        = ! empty( $_REQUEST['order']   ) ? sanitize_key( $_REQUEST['order']   ) : 'asc';
     202        $statuses     = bbp_get_public_reply_statuses();
     203
     204        // Maybe add private statuses to query
     205        if ( current_user_can( 'edit_others_replies' ) ) {
     206
     207            // Default view=all statuses
     208            $statuses = array_keys( bbp_get_topic_statuses() );
     209
     210            // Add support for private status
     211            if ( current_user_can( 'read_private_replies' ) ) {
     212                $statuses[] = bbp_get_private_status_id();
     213            }
     214        }
    202215
    203216        // Query for replies
    204217        $reply_query  = new WP_Query( array(
    205218            'post_type'           => bbp_get_reply_post_type(),
     219            'post_status'         => $statuses,
    206220            'post_parent'         => $topic_id,
    207221            'posts_per_page'      => $per_page,
     
    210224            'order'               => ucwords( $order ),
    211225            'hierarchical'        => false,
    212             'ignore_sticky_posts' => true,
     226            'ignore_sticky_posts' => true
    213227        ) );
    214228
     
    249263        $this->display_tablenav( 'top' ); ?>
    250264
    251         <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
     265        <table id="bbp-reply-list" class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
    252266            <thead>
    253267                <tr>
Note: See TracChangeset for help on using the changeset viewer.