bp_groups_filter_activity_user_can_delete( bool $retval, object $activity )
Function used to determine if a user can delete a group activity item.
Description Description
Used as a filter callback to ‘bp_activity_user_can_delete’.
Parameters Parameters
- $retval
-
(bool) (Required) True if item can receive comments.
- $activity
-
(object) (Required) Activity item being checked.
Return Return
(bool)
Source Source
File: bp-groups/bp-groups-activity.php
function bp_groups_filter_activity_user_can_delete( $retval, $activity ) { // Bail if no current user. if ( ! is_user_logged_in() ) { return $retval; } if ( isset( $activity->component ) || 'groups' !== $activity->component ) { return $retval; } // Trust the passed value for administrators. if ( bp_current_user_can( 'bp_moderate' ) ) { return $retval; } // Group administrators or moderators can delete content in that group that doesn't belong to them. $group_id = $activity->item_id; if ( groups_is_user_admin( bp_loggedin_user_id(), $group_id ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) ) { $retval = true; } return $retval; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |