Ticket #2966: 2966.patch
File 2966.patch, 1.9 KB (added by , 8 years ago) |
---|
-
wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-moderation/inc/class-plugin.php
62 62 add_filter( 'bbp_edit_topic_pre_insert', array( $this, 'pre_insert' ) ); 63 63 add_filter( 'bbp_new_reply_pre_insert', array( $this, 'pre_insert' ) ); 64 64 add_filter( 'bbp_edit_reply_pre_insert', array( $this, 'pre_insert' ) ); 65 66 // Alter queries for moderated users.67 add_filter( 'posts_where', array( $this, 'posts_where' ) );68 65 } 69 66 67 // Alter queries for the current user. 68 add_filter( 'posts_where', array( $this, 'posts_where' ) ); 69 70 70 // Add views and actions for moderators. 71 71 if ( user_can( $user_id, 'moderate' ) ) { 72 72 // Provide user moderation actions. … … 94 94 } 95 95 96 96 /** 97 * Adjust the query for moderated users.97 * Adjust the query for the current user. 98 98 */ 99 99 public function posts_where( $where ) { 100 100 global $wpdb; … … 105 105 strpos( $where, $wpdb->prepare( "$wpdb->posts.post_type = %s", bbp_get_reply_post_type() ) ) !== false 106 106 ) { 107 107 $original = $wpdb->prepare( "$wpdb->posts.post_status = %s OR ", bbp_get_public_status_id() ); 108 $replacement = $wpdb->prepare( " ( $wpdb->posts.post_status = '%s' AND $wpdb->posts.post_author = '%d' ) OR ", bbp_get_pending_status_id(), get_current_user_id() ); 108 $replacement = $wpdb->prepare( " ( $wpdb->posts.post_status IN ( %s, %s ) AND $wpdb->posts.post_author = '%d' ) OR ", 109 bbp_get_pending_status_id(), 110 bbp_get_spam_status_id(), 111 get_current_user_id() 112 ); 109 113 $where = str_replace( $original, $original . $replacement, $where ); 110 114 } 111 115 }