diff --git src/bp-groups/bp-groups-activity.php src/bp-groups/bp-groups-activity.php
index 1cafacd66..dcbcf4e51 100644
|
|
|
function groups_post_update( $args = '' ) { |
| 651 | 651 | */ |
| 652 | 652 | function bp_groups_filter_activity_user_can_delete( $retval, $activity ) { |
| 653 | 653 | // Bail if no current user. |
| | 654 | // Todo: add second conditional statement to check the state to allow group activity deletions. |
| | 655 | // e.g., "|| ! bp_enable_group_activity_deletions()". |
| 654 | 656 | if ( ! is_user_logged_in() ) { |
| 655 | 657 | return $retval; |
| 656 | 658 | } |
| 657 | 659 | |
| 658 | | if ( isset( $activity->component ) || 'groups' !== $activity->component ) { |
| | 660 | if ( isset( $activity->component ) && 'groups' !== $activity->component ) { |
| 659 | 661 | return $retval; |
| 660 | 662 | } |
| 661 | 663 | |
| 662 | | // Trust the passed value for administrators. |
| 663 | | if ( bp_current_user_can( 'bp_moderate' ) ) { |
| | 664 | // The second conditional statement does not allow "site admin" activity posts to be deleted by "non site admins". |
| | 665 | if ( bp_current_user_can( 'bp_moderate' ) || bp_user_can( $activity->user_id, 'bp_moderate' ) ) { |
| 664 | 666 | return $retval; |
| 665 | 667 | } |
| 666 | 668 | |
| 667 | | // Group administrators or moderators can delete content in that group that doesn't belong to them. |
| 668 | 669 | $group_id = $activity->item_id; |
| 669 | | if ( groups_is_user_admin( bp_loggedin_user_id(), $group_id ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) ) { |
| | 670 | |
| | 671 | // Group creator, administrators or moderators can delete content in which deletions are allowed for that group. |
| | 672 | // Todo: break this out into additional conditionals that provide granularity as to who can to what, when. |
| | 673 | if ( groups_is_user_creator( bp_loggedin_user_id(), $group_id ) || groups_is_user_admin( bp_loggedin_user_id(), $group_id ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) ) { |
| 670 | 674 | $retval = true; |
| 671 | 675 | } |
| 672 | 676 | |