Ticket #2590: 2590.2.diff
| File 2590.2.diff, 6.2 KB (added by , 9 years ago) |
|---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php
131 131 } 132 132 133 133 public function archive_handler( $action = '' ) { 134 if ( ! current_user_can( 'moderate' ) ) {135 return;136 }137 $user_id = get_current_user_id();138 139 134 if ( ! in_array( $action, $this->get_valid_actions() ) ) { 140 135 return; 141 136 } … … 144 139 return; 145 140 } 146 141 147 $post = get_post( absint( $_GET['post_id'] ) ); 142 $user_id = get_current_user_id(); 143 $post_id = absint( $_GET['post_id'] ); 144 145 $post = get_post( $post_id ); 148 146 if ( ! $post ) { 149 147 return false; 150 148 } 151 149 150 if ( ! current_user_can( 'moderate', $post->ID ) ) { 151 return; 152 } 153 152 154 // Check for empty post id. 153 155 if ( ! $post ) { 154 156 bbp_add_error( 'wporg_bbp_archive_post_id', __( '<strong>ERROR</strong>: No post was found! Which post are you archiving?', 'wporg-forums' ) ); … … 208 210 } 209 211 210 212 public function get_archive_link( $args = array() ) { 211 if ( ! current_user_can( 'moderate' ) ) {212 return false;213 }214 $user_id = get_current_user_id();215 216 213 $r = bbp_parse_args( $args, array( 217 214 'post_id' => get_the_ID(), 218 215 'archive' => esc_html__( 'Archive', 'wporg-forums' ), 219 216 'unarchive' => esc_html__( 'Unarchive', 'wporg-forums' ), 220 217 ), 'get_post_archive_link' ); 218 221 219 if ( empty( $r['post_id'] ) ) { 222 220 return false; 223 221 } 222 223 $user_id = get_current_user_id(); 224 224 $post_id = $r['post_id']; 225 225 226 226 $post = get_post( $post_id ); … … 228 228 return false; 229 229 } 230 230 231 if ( ! current_user_can( 'moderate', $post->ID ) ) { 232 return false; 233 } 234 231 235 if ( $this->is_post_archived( $post->ID ) ) { 232 236 $text = $r['unarchive']; 233 237 $query_args = array( 'action' => 'wporg_bbp_unarchive_post', 'post_id' => $post->ID ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-stickies-compat.php
207 207 208 208 if ( $user && $topic && $term ) { 209 209 // Moderators. 210 if ( user_can( $user->ID, 'moderate' ) ) {210 if ( user_can( $user->ID, 'moderate', $topic->ID ) ) { 211 211 $retval = true; 212 212 } 213 213 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-resolution/inc/class-plugin.php
505 505 $post = get_post( $topic_id ); 506 506 } 507 507 508 if ( $user_id && $post && ( user_can( $user_id, 'moderate' ) || $user_id == $post->post_author ) ) {508 if ( $user_id && $post && ( user_can( $user_id, 'moderate', $topic_id ) || $user_id == $post->post_author ) ) { 509 509 $retval = true; 510 510 } else { 511 511 $retval = false; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-badges/inc/class-plugin.php
426 426 * of badging them. Use the $strict argument to check that the user is a 427 427 * moderator without considering if they are a keymaster. 428 428 * 429 * @param string $user_id Optional. User ID. Assumes current replyauthor ID429 * @param string $user_id Optional. User ID. Assumes current post author ID 430 430 * if not provided. 431 431 * @param bool $strict Optional. True if user should strictly be checked 432 432 * for being a moderator, false will also check if they … … 435 435 */ 436 436 public function is_user_moderator( $user_id = '', $strict = false ) { 437 437 if ( ! $user_id ) { 438 $user_id = bbp_get_reply_author_id();438 $user_id = get_post_field( 'post_author' ); 439 439 } 440 440 441 return ( user_can( $user_id, 'moderate' ) || ( ! $strict && bbp_is_user_keymaster( $user_id ) ) );441 return ( user_can( $user_id, 'moderate', get_the_ID() ) || ( ! $strict && bbp_is_user_keymaster( $user_id ) ) ); 442 442 } 443 443 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/form-topic.php
159 159 160 160 <?php endif; ?> 161 161 162 <?php if ( current_user_can( 'moderate' ) ) : ?>162 <?php if ( current_user_can( 'moderate', bbp_get_topic_id() ) ) : ?> 163 163 164 164 <?php do_action( 'bbp_theme_before_topic_form_type' ); ?> 165 165 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
268 268 $seconds_passed = current_time( 'timestamp' ) - $post_time; 269 269 $hours_passed = (int) ( $seconds_passed / HOUR_IN_SECONDS ); 270 270 $post_status = get_post_status(); 271 $is_moderator = current_user_can( 'moderate' );271 $is_moderator = current_user_can( 'moderate', get_the_ID() ); 272 272 $is_user_blocked = ! current_user_can( 'spectate' ); 273 273 $notice_class = ''; 274 274 $notices = array();