BuddyDev

Search

[Resolved] Hide "Leave Group" button when user already joined the Group

  • Participant
    Level: Enlightened
    Posts: 146
    Dandy Jefferson on #3243

    Hi,
    Thanks for the help of my last topics in the support forum.

    I just wonder that is there any way to prevent Group Members to leave group? My thinking is when users joined the Group, just disable or hide the “Leave Group” button.

    So, could you help me to solve it? Thanks.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #3246

    Hi Dandy

    Please try this code in your bp-custom.php

    
    function buddydev_remove_leave_group_button( $btn ) {
    
    	
    	if ( $btn['id'] == 'leave_group' ) {
    		unset( $btn['id'] );
    	}
    
    	return $btn;
    }
    add_filter( 'bp_get_group_join_button', 'buddydev_remove_leave_group_button' );
    

    Thank You
    Ravi

  • Participant
    Level: Enlightened
    Posts: 146
    Dandy Jefferson on #3252

    Hi, Ravi
    Thanks for your reply and help.

    This code snippet works perfectly as exactly the same as I expected. Thank you very much.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #3256

    Hi Dandy

    Thank You for reply. I am glad to help you.

    Thank You
    Ravi

The topic ‘ [Resolved] Hide "Leave Group" button when user already joined the Group’ is closed to new replies.

This topic is: resolved