Skip to:
Content
Pages
Categories
Search
Top
Bottom

Removing group creation steps with BP 1.8

  • I’m wanting to streamline the group creation process for subgroups (I’m using the plugin BP Group Hierarchy). The (old) code below does remove create steps from the array $bp->groups->group_creation_steps, but as of BP 1.8, the steps are still reached in the course of creating a new group, even though they don’t appear in the navigation above the form (so I’m guessing the steps aren’t dictated by the array anymore, even though the navigation setup is).

    function remove_group_creation_steps() {
      global $bp;
      unset( $bp->groups->group_creation_steps['group-invites'] );
    }
    add_action( 'bp_before_create_group_content_template', 'remove_group_creation_steps', 9999 );

    Does anyone know the correct way to remove group creation steps in BP 1.8? Thanks in advance for your help,

    -David

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

  • Stefano Colarelli
    Participant

    @blueblueskie

    Same problem for me (only difference: I’ve not installed BP Group Hierarchy plugin).


    joh99
    Participant

    @joh99

    I’m having the same issue. I’m also without BP Group Hierarchy.

    I’m guessing a brute-force approach would be to try and add in a redirect to the next step, in order to skip the blank step screen. I’m trying to hook into the ‘bp_get_group_creation_form_action’ filter (used to determine where the user goes when he/she clicks the “Next” button in the group creation wizard). However, when I redirect a user by changing the target URL (with a simple text replacement), WordPress gives me a “are you sure you want to do this?” screen. In other words, there seems to be nonce protection that I can’t get around. I’m going to try again later.

    Again, the above is very much a brute-force and inelegant (and possibly erroneous) approach.


    joh99
    Participant

    @joh99

    @boonebgorges, do you perhaps have any ideas? Is it not possible at all to remove specific steps in the group creation process by modifying $bp->groups->group_creation_steps?

    Thanks,

    I think it really depends on the plugin. Some plugins make the creation step routine filterable (like BuddyPress docs) and some do not, unfortunately. Of course, uou could add a filter to plugins that don’t have them, and submit the changes back to the plugin author.

    In the case where it is filterable, like BP docs, you can hook in like this:

    add_filter('bp_docs_default_group_settings', 'bp_docs_default_settings_for_child_groups', 10, 1);
    function bp_docs_default_settings_for_child_groups($settings) {
      // If this new group is a child group of another group, we'll set up BP docs to match the parent group's setup. This step copies the parent group's attributes over to the child group.
      // We may have to get the parent ID from the cookie 'bp_new_group_parent_id'
        $parent_id_cookie = $_COOKIE["bp_new_group_parent_id"] ;
        $parent_settings = groups_get_groupmeta( $parent_id_cookie, 'bp-docs');
        
        if ( !empty($parent_settings) ) {
          $settings = array(
              'group-enable'  => isset( $parent_settings['group-enable'] ) ? $parent_settings['group-enable'] : 0,
              'can-create'  => isset( $parent_settings['can-create'] ) ? $parent_settings['can-create'] : 'admin',
            );
        }
    
      return $settings;
    
    }

    But as to a general case, I’ve not found the answer. Most plugins want to have their settings set on group creation, too, so you’ll need to handle that task as well.


    sharmavishal
    Participant

    @sharmavishal

    With Invite Anyone 1.2 you no longer need any additional code. That option is now included (last setting of IA settings)!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Removing group creation steps with BP 1.8’ is closed to new replies.
Skip to toolbar