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 2 replies - 1 through 2 (of 2 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.


    Piyush Asthana
    Participant

    @piyushasthana

    @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 );

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