Making WordPress.org

Changeset 5523


Ignore:
Timestamp:
05/30/2017 08:36:52 PM (9 years ago)
Author:
ocean90
Message:

Support Forums: Pass post IDs to moderate capability checks.

Props SergeyBiryukov.
Fixes #2590.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-resolution/inc/class-plugin.php

    r5039 r5523  
    506506        }
    507507
    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 ) ) {
    509509            $retval = true;
    510510        } else {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-badges/inc/class-plugin.php

    r5369 r5523  
    397397     * moderator without considering if they are a keymaster.
    398398     *
    399      * @param string $user_id Optional. User ID. Assumes current reply author ID
     399     * @param string $user_id Optional. User ID. Assumes current post author ID
    400400     *                        if not provided.
    401401     * @param bool   $strict  Optional. True if user should strictly be checked
     
    406406    public function is_user_moderator( $user_id = '', $strict = false ) {
    407407        if ( ! $user_id ) {
    408             $user_id = bbp_get_reply_author_id();
    409         }
    410 
    411         return ( user_can( $user_id, 'moderate' ) || ( ! $strict && bbp_is_user_keymaster( $user_id ) ) );
     408            $user_id = get_post_field( 'post_author' );
     409        }
     410
     411        return ( user_can( $user_id, 'moderate', get_the_ID() ) || ( ! $strict && bbp_is_user_keymaster( $user_id ) ) );
    412412    }
    413413}
Note: See TracChangeset for help on using the changeset viewer.