WordPress.org

Making WordPress.org

Ticket #4132: 4132-meta.patch

File 4132-meta.patch, 1.1 KB (added by netweb, 3 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-report-topic.php

     
    9898        }
    9999
    100100        public function add_sidebar_link() {
     101
    101102                // We don't want to allow anonymous users to report topics, we want to track who reports them.
    102103                if ( ! is_user_logged_in() ) {
    103104                        return;
    104105                }
    105106
     107                // Disallow closed support topics to be modlook reported after 6 months.
     108                $last_active_post_date = get_post_field( 'post_date', bbp_get_topic_last_active_id( $topic_id ) );
     109
     110                if ( ( time() - strtotime( $last_active_post_date ) ) / MONTH_IN_SECONDS >= 6 ) {
     111                        return;
     112                }
     113
    106114                $current_user     = get_current_user_id();
    107115                $previous_reports = $this->get_previous_reports();
    108116                $is_reported      = has_term( 'modlook', 'topic-tag', bbp_get_topic_id() );