Changeset 6791 for trunk/src/includes/admin/replies.php
- Timestamp:
- 03/29/2018 06:03:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/replies.php
r6790 r6791 80 80 add_filter( 'restrict_manage_posts', array( $this, 'filter_dropdown' ) ); 81 81 add_filter( 'bbp_request', array( $this, 'filter_post_rows' ) ); 82 83 // Empty spam 84 add_filter( 'manage_posts_extra_tablenav', array( $this, 'filter_empty_spam' ) ); 82 85 83 86 // Contextual Help … … 471 474 check_admin_referer( 'approve-reply_' . $reply_id ); 472 475 473 $is_approve = bbp_is_reply_publi shed( $reply_id );476 $is_approve = bbp_is_reply_public( $reply_id ); 474 477 $message = ( true === $is_approve ) 475 478 ? 'unpproved' 476 479 : 'approved'; 477 480 $success = ( true === $is_approve ) 478 ? bbp_ approve_reply( $reply_id )479 : bbp_ unapprove_reply( $reply_id );481 ? bbp_unapprove_reply( $reply_id ) 482 : bbp_approve_reply( $reply_id ); 480 483 481 484 break; … … 801 804 if ( current_user_can( 'moderate', $reply->ID ) ) { 802 805 803 // Show the 'approve' link on pendingposts only and 'unapprove' on published posts only806 // Show the 'approve' link on non-published posts only and 'unapprove' on published posts only 804 807 $approve_uri = wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_approve' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'approve-reply_' . $reply->ID ); 805 if ( bbp_is_reply_publi shed( $reply->ID ) ) {808 if ( bbp_is_reply_public( $reply->ID ) ) { 806 809 $actions['unapproved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Unapprove this reply', 'bbpress' ) . '">' . _x( 'Unapprove', 'Unapprove reply', 'bbpress' ) . '</a>'; 807 } else if ( ! bbp_is_reply_private( $reply->ID ) ){810 } else { 808 811 $actions['approved'] = '<a href="' . esc_url( $approve_uri ) . '" title="' . esc_attr__( 'Approve this reply', 'bbpress' ) . '">' . _x( 'Approve', 'Approve reply', 'bbpress' ) . '</a>'; 809 812 } 810 813 811 814 // Show the 'spam' link on published and pending replies and 'not spam' on spammed replies 812 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_ pending_status_id(), bbp_get_spam_status_id() ), true ) ) {815 if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id(), bbp_get_spam_status_id() ), true ) ) { 813 816 $spam_uri = wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_' . $reply->ID ); 814 if ( bbp_is_reply_spam( $reply->ID ) ) { 817 if ( ! bbp_is_reply_spam( $reply->ID ) ) { 818 $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark this reply as spam', 'bbpress' ) . '">' . esc_html__( 'Spam', 'bbpress' ) . '</a>'; 819 } else { 815 820 $actions['unspam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the reply as not spam', 'bbpress' ) . '">' . esc_html__( 'Not Spam', 'bbpress' ) . '</a>'; 816 } else {817 $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark this reply as spam', 'bbpress' ) . '">' . esc_html__( 'Spam', 'bbpress' ) . '</a>';818 821 } 819 822 } … … 833 836 if ( ( bbp_get_trash_status_id() === $reply->post_status ) || empty( $trash_days ) ) { 834 837 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'bbpress' ) . "' href='" . esc_url( get_delete_post_link( $reply->ID, '', true ) ) . "'>" . esc_html__( 'Delete Permanently', 'bbpress' ) . "</a>"; 835 } elseif ( bbp_get_spam_status_id() === $reply->post_status ) {836 unset( $actions['trash'] );837 838 } 838 839 } … … 880 881 public function filter_dropdown() { 881 882 882 // Add "Empty Spam" button for moderators 883 if ( ! empty( $_GET['post_status'] ) && ( bbp_get_spam_status_id() === $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { 883 // Get which forum is selected 884 $selected = ! empty( $_GET['bbp_forum_id'] ) 885 ? (int) $_GET['bbp_forum_id'] 886 : 0; 887 888 // Show the forums dropdown 889 bbp_dropdown( array( 890 'selected' => $selected, 891 'show_none' => esc_html__( 'In all forums', 'bbpress' ) 892 ) ); 893 } 894 895 /** 896 * Add "Empty Spam" button for moderators 897 * 898 * @since 2.6.0 bbPress (r6791) 899 */ 900 public function filter_empty_spam() { 901 902 // Bail if not viewing spam 903 if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { 904 return; 905 } 906 907 ?> 908 909 <div class="alignleft actions"><?php 910 911 // Output the nonce & button 884 912 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); 885 913 submit_button( … … 889 917 false 890 918 ); 891 } 892 893 // Get which forum is selected 894 $selected = ! empty( $_GET['bbp_forum_id'] ) 895 ? (int) $_GET['bbp_forum_id'] 896 : 0; 897 898 // Show the forums dropdown 899 bbp_dropdown( array( 900 'selected' => $selected, 901 'show_none' => esc_html__( 'In all forums', 'bbpress' ) 902 ) ); 919 920 ?></div><?php 903 921 } 904 922
Note: See TracChangeset
for help on using the changeset viewer.