Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/28/2023 04:15:02 PM (2 years ago)
Author:
dcavins
Message:

Introduce bp_view capability.

Introduce a new, base-level capability, bp_view,
that by default maps to the most base-level WordPress
capability, exist.

See #8734.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r13436 r13531  
    33053305    }
    33063306
     3307    if ( ! bp_current_user_can( 'bp_view', array( 'bp_component' => 'activity' ) ) ) {
     3308        $retval = false;
     3309    }
     3310
    33073311    // If activity is from a group, do extra cap checks.
    3308     if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $activity->component ) {
     3312    if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $activity->component && bp_current_user_can( 'bp_view', array( 'bp_component' => 'groups' ) ) ) {
    33093313        // Check to see if the user has access to the activity's parent group.
    33103314        $group = groups_get_group( $activity->item_id );
     
    44834487 *
    44844488 * @since 8.0.0
     4489 * @since 12.0.0 Added bp_current_user_can( 'bp_view' ) check.
    44854490 *
    44864491 * @param string $feed_id The feed identifier. Possible values are:
     
    44884493 */
    44894494function bp_activity_is_feed_enable( $feed_id = '' ) {
     4495    $retval = bp_current_user_can( 'bp_view', array( 'bp_component' => 'activity' ) );
     4496
    44904497    /**
    44914498     * Filters if BuddyPress should consider feeds enabled. If disabled, it will return early.
     
    44944501     * @since 8.0.0 Adds the `$feed_id` parameter.
    44954502     *
    4496      * @param bool   $value   Defaults to true aka feeds are enabled.
     4503     * @param bool   $retval  Whether this feed is enabled or not.
    44974504     * @param string $feed_id The feed identifier.
    44984505     */
    4499     return (bool) apply_filters( 'bp_activity_enable_feeds', true, $feed_id );
    4500 }
     4506    return (bool) apply_filters( 'bp_activity_enable_feeds', $retval, $feed_id );
     4507}
Note: See TracChangeset for help on using the changeset viewer.