BP_REST_Activity_Endpoint::show_hidden( string $component, int $item_id )
Show hidden activity?
Description
Parameters
- $component
-
(Required) The activity component.
- $item_id
-
(Required) The activity item ID.
Return
(boolean)
Source
File: bp-activity/classes/class-bp-rest-activity-endpoint.php
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | protected function show_hidden( $component , $item_id ) { $user_id = get_current_user_id(); $retval = false; if ( ! is_null ( $component ) ) { // If activity is from a group, do an extra cap check. if ( ! $retval && ! empty ( $item_id ) && bp_is_active( $component ) && buddypress()->groups->id === $component ) { // Group admins and mods have access as well. if ( groups_is_user_admin( $user_id , $item_id ) || groups_is_user_mod( $user_id , $item_id ) ) { $retval = true; // User is a member of the group. } elseif ( (bool) groups_is_user_member( $user_id , $item_id ) ) { $retval = true; } } } // Moderators as well. if ( bp_current_user_can( 'bp_moderate' ) ) { $retval = true; } return (bool) $retval ; } |
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.