如何在buddypress中编辑非管理员用户的组创建步骤

In my buddypress setup, I have the groups component enabled. I also have the bp docs, bbpress, invite anyone plugins installed.

Currently when I create a group regardless who I am logged in as, I get prompt the following steps in the following order:

  1. group-details
  2. group-settings
  3. forum
  4. resources
  5. invite anyone

I would like to preserve all these steps for the admin keymaster users but I would like to disable the forum and resources steps. How can I achieve this?

I have attempted to use the following code at the top of the create.php within the groups directory:

global $bp;
if(!bbp_is_user_keymaster()){
    unset( $bp->groups->group_creation_steps['forum'] );
    unset( $bp->groups->group_creation_steps['resources'] );
}

Unfortunately this code doesn't work so well as the page still redirects to the forum step after group-settings. The forum page does appear to be empty with back and next buttons being visible. If click on the next button, I get a page error and if I click on the back button, I get redirected to the invite-anyone step.

You need to take a look at do_action( 'groups_custom_create_steps' ); and actually use remove_action();. You will need to investigate the functions/methods that are used and hooked on groups_custom_create_steps. Thus you will be able to remove empty screens of steps as well.

Also, it's better to place your code into bp-custom.php, and not in theme files.