bp_groups_allow_mods_to_delete_activity( bool $can_delete, false|BP_Activity_Activity $activity )

Filter the bp_activity_user_can_delete value to allow moderators to delete activities of a group.

Description

Parameters

$can_delete

(Required) Whether or not the current user has the capability.

$activity

(Required)

Return

(bool)

Source

File: bp-groups/bp-groups-filters.php

function bp_groups_allow_mods_to_delete_activity ( $can_delete, $activity ) {

	// Allow Mods to delete activity of group
	if ( ! $can_delete && is_user_logged_in() && 'groups' == $activity->component ) {
		$group = groups_get_group( $activity->item_id );

		if ( ! empty( $group ) &&
		     ! groups_is_user_admin( $activity->user_id, $activity->item_id ) &&
		     groups_is_user_mod( apply_filters( 'bp_loggedin_user_id', get_current_user_id() ), $activity->item_id )
		) {
			$can_delete = true;
		}
	}

	return $can_delete;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.