Changeset 13531
- Timestamp:
- 07/28/2023 04:15:02 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
bp-activity/bp-activity-functions.php (modified) (4 diffs)
-
bp-core/bp-core-caps.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r13436 r13531 3305 3305 } 3306 3306 3307 if ( ! bp_current_user_can( 'bp_view', array( 'bp_component' => 'activity' ) ) ) { 3308 $retval = false; 3309 } 3310 3307 3311 // 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' ) ) ) { 3309 3313 // Check to see if the user has access to the activity's parent group. 3310 3314 $group = groups_get_group( $activity->item_id ); … … 4483 4487 * 4484 4488 * @since 8.0.0 4489 * @since 12.0.0 Added bp_current_user_can( 'bp_view' ) check. 4485 4490 * 4486 4491 * @param string $feed_id The feed identifier. Possible values are: … … 4488 4493 */ 4489 4494 function bp_activity_is_feed_enable( $feed_id = '' ) { 4495 $retval = bp_current_user_can( 'bp_view', array( 'bp_component' => 'activity' ) ); 4496 4490 4497 /** 4491 4498 * Filters if BuddyPress should consider feeds enabled. If disabled, it will return early. … … 4494 4501 * @since 8.0.0 Adds the `$feed_id` parameter. 4495 4502 * 4496 * @param bool $ value Defaults to true aka feeds are enabled.4503 * @param bool $retval Whether this feed is enabled or not. 4497 4504 * @param string $feed_id The feed identifier. 4498 4505 */ 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 } -
trunk/src/bp-core/bp-core-caps.php
r13450 r13531 125 125 * 126 126 * @since 1.6.0 127 * @since 12.0.0 Added mapping for `bp_view` capability. 127 128 * 128 129 * @see WP_User::has_cap() for description of the arguments passed to the … … 137 138 */ 138 139 function bp_map_meta_caps( $caps, $cap, $user_id, $args ) { 140 141 switch ( $cap ) { 142 case 'bp_view' : 143 $caps = array( 'exist' ); 144 if ( ! $user_id ) { 145 146 // A BuddyPress component ID may be optionally passed with the `bp_view` check. 147 $component = isset( $args['bp_component'] ) ? $args['bp_component'] : ''; 148 149 if ( 'members' === bp_get_community_visibility( $component ) ) { 150 $caps = array( 'do_not_allow' ); 151 } 152 } 153 break; 154 } 139 155 140 156 /**
Note: See TracChangeset
for help on using the changeset viewer.