admin管理员组

文章数量:1122832

In WordPress, I have BuddyPress and bbPress installed. bbPress creates an integration with BuddyPress where you can add forums to BuddyPress groups.

I want to remove the "Forum" step from the BuddyPress group creation step but keep the group forums active. I have tried many solutions but I can't seem to find a filter I could use.

For example, this code:

add_filter( 'groups_create_group_steps', function ( $steps ) {
    unset( $steps['group-settings'] );
    return $steps;
} );

removes the group settings from the group creation process.

This code:

function buddydev_remove_group_admin_settings() {

    if ( ! bp_is_group() ) {
        return;
    }

    bp_core_remove_subnav_item( groups_get_current_group()->slug . '_manage', 'group-settings', 'groups' );

    // reattach screen function to avoid 404.
    add_action( 'bp_screens', 'groups_screen_group_admin', 3 );
}

add_action( 'bp_template_redirect', 'buddydev_remove_group_admin_settings', 1 );

removes the group settings from the Group "Manage" menu.

Using this:

function remove_unwanted_group_creation_steps() {
    global $bp;
    if ( isset( $bp->groups->group_creation_steps['forum'] ) ) {
        unset( $bp->groups->group_creation_steps['forum'] );
    }

}
add_action( 'bp_before_create_group_content_template', 'remove_unwanted_group_creation_steps', 9999 );

removes the step but leaves the /create/step/forum/ URL active, thus messing with the custom number of steps I have.

Can you please help?

When I use:

function remove_unwanted_group_creation_steps() {
    global $bp;
    if ( isset( $bp->groups->group_creation_steps['forum'] ) ) {
        unset( $bp->groups->group_creation_steps['forum'] );
    }

}
add_action( 'bp_before_create_group_content_template', 'remove_unwanted_group_creation_steps', 9999 );
add_filter( 'groups_create_group_steps', function ( $steps ) {
    unset( $steps['group-settings'] );
    return $steps;
} );
add_action( 'template_redirect', function() {
    if ( bp_is_group_creation_step( 'forum' ) ) {
        wp_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/docs/' ); // Adjust to the step you want
        exit;
    }
});

The Forum step at the top is being removed but after I click the Finish button to the last step (3. Invites), I get redirected to the first step (1. Details), instead of the newly created group's default tab.

I also get a PHP Notice: Undefined variable: next_step in [SITEPATH]\wp-content\plugins\buddypress\bp-groups\actions\create.php on line 221 after clicking the Finish button on the last step.

In WordPress, I have BuddyPress and bbPress installed. bbPress creates an integration with BuddyPress where you can add forums to BuddyPress groups.

I want to remove the "Forum" step from the BuddyPress group creation step but keep the group forums active. I have tried many solutions but I can't seem to find a filter I could use.

For example, this code:

add_filter( 'groups_create_group_steps', function ( $steps ) {
    unset( $steps['group-settings'] );
    return $steps;
} );

removes the group settings from the group creation process.

This code:

function buddydev_remove_group_admin_settings() {

    if ( ! bp_is_group() ) {
        return;
    }

    bp_core_remove_subnav_item( groups_get_current_group()->slug . '_manage', 'group-settings', 'groups' );

    // reattach screen function to avoid 404.
    add_action( 'bp_screens', 'groups_screen_group_admin', 3 );
}

add_action( 'bp_template_redirect', 'buddydev_remove_group_admin_settings', 1 );

removes the group settings from the Group "Manage" menu.

Using this:

function remove_unwanted_group_creation_steps() {
    global $bp;
    if ( isset( $bp->groups->group_creation_steps['forum'] ) ) {
        unset( $bp->groups->group_creation_steps['forum'] );
    }

}
add_action( 'bp_before_create_group_content_template', 'remove_unwanted_group_creation_steps', 9999 );

removes the step but leaves the /create/step/forum/ URL active, thus messing with the custom number of steps I have.

Can you please help?

When I use:

function remove_unwanted_group_creation_steps() {
    global $bp;
    if ( isset( $bp->groups->group_creation_steps['forum'] ) ) {
        unset( $bp->groups->group_creation_steps['forum'] );
    }

}
add_action( 'bp_before_create_group_content_template', 'remove_unwanted_group_creation_steps', 9999 );
add_filter( 'groups_create_group_steps', function ( $steps ) {
    unset( $steps['group-settings'] );
    return $steps;
} );
add_action( 'template_redirect', function() {
    if ( bp_is_group_creation_step( 'forum' ) ) {
        wp_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/docs/' ); // Adjust to the step you want
        exit;
    }
});

The Forum step at the top is being removed but after I click the Finish button to the last step (3. Invites), I get redirected to the first step (1. Details), instead of the newly created group's default tab.

I also get a PHP Notice: Undefined variable: next_step in [SITEPATH]\wp-content\plugins\buddypress\bp-groups\actions\create.php on line 221 after clicking the Finish button on the last step.

Share Improve this question edited Sep 27, 2024 at 12:26 quantum_leap asked Sep 26, 2024 at 21:21 quantum_leapquantum_leap 419 bronze badges 1
  • comment for people who propose to close this question : bbpress and buddypress are the 2 only plugins which are on-topic here then I think that this question can remain open. – mmm Commented Sep 27, 2024 at 12:54
Add a comment  | 

1 Answer 1

Reset to default 0

Could you please try to use the given code which we need to add functions.php file of theme.

Use Case : This is to remove the Forum step from the group creation process.

add_filter('groups_create_group_steps', function( $steps ) {
    unset( $steps['forum'] );
    return $steps;
});

Use Case : This is to redirect any attempts to access the forum step URL.

add_action( 'template_redirect', function() {
    if ( bp_is_group_creation_step( 'forum' ) ) {
        wp_redirect( bp_get_group_create_slug() ); // Redirect to the first step of group creation
        exit;
    }
});

Thanks

本文标签: phpRemove quotForumquot from BuddyPress group creation step