Skip to:
Content

bbPress.org

Changeset 4721


Ignore:
Timestamp:
01/27/2013 12:38:01 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Rearrange the way map_group_forum_meta_caps() is used. See #2089.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/extend/buddypress/group.php

    r4717 r4721  
    111111        add_filter( 'post_type_link',            array( $this, 'post_type_link'               ), 10, 2 );
    112112
    113         // Allow group member to view private/hidden forums
    114         add_filter( 'bbp_map_meta_caps',         array( $this, 'map_group_forum_meta_caps'    ), 99, 4 );
    115 
    116113        // Map group forum activity items to groups
    117114        add_filter( 'bbp_before_record_activity_parse_args', array( $this, 'map_activity_to_group' ) );
     
    120117        add_filter( 'bbp_get_forum_subforum_count_int', array( $this, 'no_subforums_yet' ) );
    121118
    122         // Group member permissions to view the topic and reply forms
    123         add_filter( 'bbp_current_user_can_access_create_topic_form', array( $this, 'form_permissions' ) );
    124         add_filter( 'bbp_current_user_can_access_create_reply_form', array( $this, 'form_permissions' ) );
     119        /** Caps **************************************************************/
     120
     121        // Only add these filters if inside a group forum
     122        if ( bp_is_single_item() && bp_is_groups_component() && bp_is_current_action( 'forum' ) ) {
     123
     124            // Allow group member to view private/hidden forums
     125            add_filter( 'bbp_map_meta_caps', array( $this, 'map_group_forum_meta_caps' ), 10, 4 );
     126
     127            // Group member permissions to view the topic and reply forms
     128            add_filter( 'bbp_current_user_can_access_create_topic_form', array( $this, 'form_permissions' ) );
     129            add_filter( 'bbp_current_user_can_access_create_reply_form', array( $this, 'form_permissions' ) );
     130        }
    125131    }
    126132
     
    178184     */
    179185    public function map_group_forum_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
    180 
    181         // Bail if not viewing a group forum
    182         if ( ! bp_is_single_item() || ! bp_is_groups_component() || ! bp_is_current_action( 'forum' ) )
    183             return $caps;
    184186
    185187        switch ( $cap ) {
Note: See TracChangeset for help on using the changeset viewer.