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.
- 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
1 Answer
Reset to default 0Could 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
版权声明:本文标题:php - Remove "Forum" from BuddyPress group creation step 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736287525a1927898.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论