Hi there
Is there any way of preventing users (other than admin) from deleting their own activity eg. I don’t want them to be able to delete entries such as “User x updated their profile”.
I’ve successfully prevented commenting on certain activities using bp_activity_can_comment and I’m thinking maybe I can use bp_activity_user_can_delete in a similar way, but can’t seem to make that work.
Any suggestions would be gratefully received.
With many thanks in advance.
PS. I know I can hide “Delete” with CSS but would really prefer to use a filter instead.
Hi NikB,
Please add the following code to your bp-custom.php
/** * Disable BuddyPress activity delete by the user. * * @param bool $can_delete flag. * @param BP_Activity_Activity $activity Activity object. * * @return bool */ function buddydev_disable_activity_delete( $can_delete, $activity ) { if ( ! is_super_admin() ) { $can_delete = false; } return $can_delete; } add_filter( 'bp_activity_user_can_delete', 'buddydev_disable_activity_delete', 10, 2 );
Regards
Ravi
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘ [Resolved] Prevent user from deleting their activity’ is closed to new replies.
This topic is: resolved