Skip to:
Content

bbPress.org

Changeset 6220


Ignore:
Timestamp:
01/12/2017 08:57:34 AM (5 years ago)
Author:
johnjamesjacoby
Message:

BuddyPress: Additional conditionals for group forum topic checks.

Fixes #2974. Props r-a-y.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/extend/buddypress/groups.php

    r6202 r6220  
    109109    private function setup_filters() {
    110110
     111        // Ensure bbp_is_single_topic() returns true on group forum topics.
     112        add_filter( 'bbp_is_single_topic',       array( $this, 'is_single_topic' ) );
     113
    111114        // Group forum pagination
    112115        add_filter( 'bbp_topic_pagination',      array( $this, 'topic_pagination'   ) );
     
    145148            add_filter( 'bbp_current_user_can_access_create_reply_form', array( $this, 'form_permissions' ) );
    146149        }
     150    }
     151
     152    /**
     153     * Ensure that bbp_is_single_topic() returns true on group forum topic pages.
     154     *
     155     * @see https://bbpress.trac.wordpress.org/ticket/2974
     156     *
     157     * @since 2.6.0 bbPress (r6220)
     158     *
     159     * @param  bool $retval Current boolean.
     160     * @return bool
     161     */
     162    public function is_single_topic( $retval = false ) {
     163
     164        // Additional BuddyPress specific single-topic conditionals
     165        if ( false === $retval ) {
     166            if ( bp_is_group() && bp_is_action_variable( $this->topic_slug, 0 ) && bp_action_variable( 1 ) ) {
     167                $retval = true;
     168            }
     169        }
     170
     171        return $retval;
    147172    }
    148173
Note: See TracChangeset for help on using the changeset viewer.