Skip to:

Custom group creation steps (and the “Are you sure you want to do this?” screen)

  • itsasiak


    Hi all,

    I am working in a site with WP4.5.1 + BP 2.5.2 + bbpress 2.5.8

    I have been working on a custom group creation process and I got some good stuff I just want to share with the community. I have noticed that the group creation steps are stored within the $bp object and that they can be accessed and reseted. The standard group creation steps are the following (though they may be reordered in your installation or have less or more steps):

    1. Group Details 2. Group Settings 3. Forum 4. Group Avatar 5. Group Image Cover 6. Invite friends

    In my case, I needed to get rid of some of those steps and, as well, “Group Image Cover” step was prompting me to the “Are you sure you want to do this?” screen (I think it is related to the nonces, but I am not sure about this).

    You can list your particular group creation steps by copying this snippet somewhere in your site (they will be listed in a page – I used my /group/create.php template). I took a part of the code from the function “groups_action_sort_creation_steps”, located in /buddypress/bp-groups/bp-groups-actions.php:

    <?php global $bp;
    foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    while ( !empty( $temp[$step['position']] ) )
    $temp[$step['position']] = array( 'name' => $step['name'], 'slug' => $slug );
    print_r(array_values($temp)); ?>

    Once you have your steps and you have decided which you want to get rid of, build the array to be passed to the $bp object following this model and the information you found in the previous list:

    $temp = array(
    "0" => array("name" => "Details","slug" =>"group-details" ),
    '1' => array("name" => "Information","slug" =>"plus-tab"),
    '2' => array("name" => "Forum","slug" =>"forum" ),

    And then place this action hook in your bp-custom.php (which is also inspired in the sorting function):

    function custom_group_creation_steps() {
    global $bp;

    $temp = array(
    "0" => array("name" => "Details","slug" =>"group-details" ),
    '1' => array("name" => "Information","slug" =>"plus-tab"),
    '2' => array("name" => "Forum","slug" =>"forum" ),

    foreach( (array) $temp as $position => $step )
    $bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position );

    add_action( 'bp_init', 'custom_group_creation_steps' );

    As I got rid of the “Image Cover Step”, now my group creation process does not print the annoying “are you sure you want to do this?” screen. But this screen is related to particular setups, so I cannot guarantee you’ll get rid of it with this code.

    Happy coding!

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

  • acedesign123


    Hi @itsasiak

    I am facing the same problem, That i get the error message of Are you sure you want to do this? on the second step after I create the group name and description.

    My bp-custom.php file looks like this.

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

    This code hides the menus on top when I create a group, as seen by the image
    Image Group

    But If I click FINISH it takes me to this screen ::

    Error Group

    Do you know where I can put code to solve this?




    the error is because you’re loosing the current user.
    Read codex about Navigation API (since 2.6) and use the new code to remove properly group settings tabs.

    Navigation API



    Hi @danbp

    Thank you for the response, however I am new to BuddyPress, but I do know Theme Dev in WP in Gen, my situation is this,

    I want to remove all other steps and just fill in the details as you see on the first screen and just click finish, and have the group created. That is all.

    I just tried the :: Remove Sub-Nav Tabs from the link you provide and it does not work.
    Secondly, should I be putting the code on bp-custom.php


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