Making WordPress.org

Changeset 5957


Ignore:
Timestamp:
09/22/2017 07:03:13 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums, User Moderation: Display a notice indicating that a post is being held for moderation to non-flagged users as well.

Amends [4216] to always display the notice when appropriate.

Fixes #2966.

File:
1 edited

Legend:

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

    r5157 r5957  
    6363            add_filter( 'bbp_new_reply_pre_insert',  array( $this, 'pre_insert' ) );
    6464            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        }
     66
     67        // Alter queries for the current user.
     68        add_filter( 'posts_where', array( $this, 'posts_where' ) );
    6969
    7070        // Add views and actions for moderators.
     
    9595
    9696    /**
    97      * Adjust the query for moderated users.
     97     * Adjust the query for the current user.
    9898     */
    9999    public function posts_where( $where ) {
     
    106106            ) {
    107107                $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                );
    109113                $where = str_replace( $original, $original . $replacement, $where );
    110114            }
Note: See TracChangeset for help on using the changeset viewer.