Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group admin & mod not able to delete group activity posts and comments


  • mewtwo9519
    Participant

    @mihai440

    Hello,
    Users have noticed that if they create a group they cannot moderate it. They can delete it, change privacy and all that but when it comes to deleting activity posts and comments the “delete” button simply doesn’t appear.
    For the website key master it appears and works like before .

    Are you familiar with this issue? What can I do to make group admins and moderators able to delete activity in their own group like before?

    Any help is greatly appreciated.

    Thank you

    PS. I’m running BP 11.0.0 on WP 6.1.1

Viewing 3 replies - 1 through 3 (of 3 total)

  • mewtwo9519
    Participant

    @mihai440

    Any way to force this using bp-custom.php? The codex says it should work but it simply doesn’t. The site is 10+ years old and was stuck for some time with an older WP & BP version. The latest version used was 6.1.0 and users reported this problem so I updated everything hoping it would help

    Please help me with this


    mewtwo9519
    Participant

    @mihai440

    Found this.

    <?php
    function majecdad_group_mod_delete( $can_delete, $activity ) {
    	
       if( $activity->component == 'groups' ) {
    	
    	$group_id = $activity->item_id; 
    		
    	if( bp_current_user_can( 'bp_moderate' ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) )
    	    $can_delete = true;
    	
       }
    
       return $can_delete;
    }
    add_filter('bp_activity_user_can_delete', 'majecdad_group_mod_delete', 21, 2 );
    ?>

    This code works great but only for moderators (not for admins) and only activity posts in a group and not the comments.

    Can anyone please help me with a code like this for bp-custom.php but that gives both admins and mods the “power” to delete activity posts and also comments in the groups they are admin/mod?

    Thank you

    Hi try to replace:
    if( bp_current_user_can( 'bp_moderate' ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) )

    With:
    if( bp_current_user_can( 'bp_moderate' ) || groups_is_user_mod( bp_loggedin_user_id(), $group_id ) || groups_is_user_admin( bp_loggedin_user_id(), $group_id ) )

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.