WordPress.org

Making WordPress.org

Changeset 3991


Ignore:
Timestamp:
09/07/2016 03:54:27 PM (3 years ago)
Author:
jmdodd
Message:

Support Forum: Avoid displaying the new topic form at the bottom of the reviews forum.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php

    r3972 r3991  
    4545            // Always check to see if a new topic is being posted.
    4646            add_action( 'bbp_new_topic_post_extras', array( $this, 'topic_post_extras' ) );
     47
     48            // Remove new topic form at the bottom of reviews forum.
     49            add_filter( 'bbp_get_template_part', array( $this, 'noop_reviews_forum_form_topic' ), 10, 3 );
    4750        }
    4851    }
     
    386389    }
    387390
     391    /**
     392     * Filter the template fetch to avoid displaying a new topic form in the reviews forum.
     393     *
     394     * @param array $templates The templates to load
     395     * @param string $slug The template slug
     396     * @param string $name The template name
     397     * @return array|false The templates, or false if nooped
     398     */
     399    public function noop_reviews_forum_form_topic( $templates, $slug, $name ) {
     400        if (
     401            'form' == $slug && 'topic' == $name
     402        &&
     403            bbp_is_single_forum() && Plugin::REVIEWS_FORUM_ID == bbp_get_forum_id()
     404        ) {
     405            return false;
     406        }
     407        return $templates;
     408    }
     409
    388410    public function topic_post_extras( $topic_id ) {
    389411        if (
Note: See TracChangeset for help on using the changeset viewer.