Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable Group abandonment and Group access request


  • hcmendez
    Participant

    @hcmendez

    Hi, is it possible to disable those actions altogether?

    Our site will be a members directory where the user will register and buy a membership and they will be added to a specific membership group we don’t want users to leave the group.

    I saw a post from 9 years ago but didn’t get any answer.

    Disable Leave Group on Specific Groups

    This is the code the user mentioned:

    if ( $group->is_member ) {
    
    // Stop sole admins from abandoning their group
    $group_admins = groups_get_group_admins( $group->id );
    if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == bp_loggedin_user_id() )
    return false;
    
    $button = array(
    'id'                => 'leave_group',
    'component'         => 'groups',
    'must_be_logged_in' => true,
    'block_self'        => false,
    'wrapper_class'     => 'group-button ' . $group->status,
    'wrapper_id'        => 'groupbutton-' . $group->id,
    'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ),
    'link_text'         => __( 'Leave Group', 'buddypress' ),
    'link_title'        => __( 'Leave Group', 'buddypress' ),
    'link_class'        => 'group-button leave-group',
    );

    This code can do what I need? If so, how can I use this code? I tried with Code Snippets and it didn’t work.

  • You must be logged in to reply to this topic.
Skip to toolbar