Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove invite members link for group members


  • andrew_long15
    Participant

    @andrew_long15

    I have “Who can invite others to this group?” set to “Group admins only”. Members are still able to see the “send invites” link. When they click on the link it says only admins can invite. How do I get rid of the “send invites” link so that the member cannot see it.

    Also, on group home page it says “Hidden Group”. Can I get rid of that “Hidden Group” header or replace it with other text?

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

  • andrew_long15
    Participant

    @andrew_long15

    How can I remove the “send invites” button. Group members do not have option to invite so there should be no button.


    Anonymous User 16480907
    Inactive

    @anonymized-16480907

    @andrew_long15

    use this code.

    /**
    * Removes send invite tab according to Group Invitations setting.
    *
    * @since 2.2.0
    */
    function remove_send_invite_tab() {
    if ( ! bp_is_group() || ( bp_is_current_action( ‘admin’ ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
    return;
    }

    // Add the admin subnav slug you want to hide in the following array.
    $hide_tabs = array(
    ‘send-invites’ => 1,
    );

    $parent_nav_slug = bp_get_current_group_slug();
    $current_group_id = bp_get_current_group_id();
    $invite_status = groups_get_groupmeta( $current_group_id, ‘invite_status’, true );
    if ( ‘admins’ === $invite_status || ‘mods’ === $invite_status ) {
    // Remove the nav items.
    foreach ( array_keys( $hide_tabs ) as $tab ) {
    bp_core_remove_subnav_item( $parent_nav_slug, $tab, ‘groups’ );
    }
    }

    // You may want to be sure the user can’t access.
    if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) {
    bp_core_add_message( ‘No tienes suficientes permisos para acceder.’, ‘error’ );
    bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );
    }
    }
    add_action( ‘bp_actions’, ‘remove_send_invite_tab’, 9 );


    briebree
    Participant

    @briebree

    @andrew_long15
    @anonymized-16480907

    Hello
    I tried to paste the code in the code snippets plugin, but the “select members” feature still show in the “Send Invitation” tab of the group.

    is it possible any specific explaination.
    thank you


    Abhishek Saini
    Participant

    @abhishek6394

    @andrew_long15 , you can simply add this to remove the invites tab from all the groups.

    add_filter( ‘bp_groups_user_can_send_invites’, ‘__return_false’ );


    briebree
    Participant

    @briebree

    @abhishek6394
    thank you

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