WordPress.org

Making WordPress.org

Changeset 9301


Ignore:
Timestamp:
11/26/2019 11:54:02 PM (2 years ago)
Author:
dd32
Message:

Support: Disable entire-forum subscriptions (again).

bbPress 2.6 deprecated the previous function and no longer calls its filters.
This more complicated filter should hopefully have the same effect again.

See #4782.

File:
1 edited

Legend:

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

    r9242 r9301  
    5353
    5454        // Disable entire-forum subscriptions.
    55         add_filter( 'bbp_get_forum_subscribers', '__return_empty_array' );
     55        add_filter( 'bbp_get_forum_subscribers', '__return_empty_array' ); // bbPress 2.5; 2.6 deprecated
     56        add_filter( 'bbp_get_subscribers', array( $this, 'bbp_get_subscribers' ), 10, 3 ); // bbPress 2.6
    5657    }
    5758
     
    462463        bbp_deregister_view( 'popular' );
    463464    }
     465
     466    /**
     467     * Block forum subscriptions.
     468     *
     469     * No user ever actually intends to subscribe to an entire forum, so lets just never do that.
     470     */
     471    function bbp_get_subscribers( $user_ids, $object_id, $type ) {
     472        // We don't want anyone subscribing to a forum, null it out if that happens.
     473        if ( 'post' === $type && bbp_is_forum( $object_id ) ) {
     474            $user_ids = array();
     475        }
     476
     477        return $user_ids;
     478    }
    464479}
Note: See TracChangeset for help on using the changeset viewer.