Changeset 13449 for trunk/src/bp-groups/actions/create.php
- Timestamp:
- 04/08/2023 06:31:46 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/actions/create.php
r13437 r13449 31 31 } 32 32 33 $bp = buddypress(); 33 $bp = buddypress(); 34 $redirect_url = bp_groups_get_create_url(); 34 35 35 36 // Make sure creation steps are in the right order. … … 45 46 setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 46 47 47 $reset_steps = true; 48 $keys = array_keys( $bp->groups->group_creation_steps ); 49 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . array_shift( $keys ) ) ); 48 $reset_steps = true; 49 $keys = array_keys( $bp->groups->group_creation_steps ); 50 $action_variable = array_shift( $keys ); 51 bp_core_redirect( bp_groups_get_create_url( array( $action_variable ) ) ); 50 52 } 51 53 … … 53 55 if ( bp_get_groups_current_create_step() && empty( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()] ) ) { 54 56 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 55 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ));57 bp_core_redirect( $redirect_url ); 56 58 } 57 59 … … 67 69 if ( ! bp_is_group_creator( $bp->groups->current_group, bp_loggedin_user_id() ) ) { 68 70 bp_core_add_message( __( 'Only the group creator may continue editing this group.', 'buddypress' ), 'error' ); 69 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ));71 bp_core_redirect( $redirect_url ); 70 72 } 71 73 } … … 80 82 if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) { 81 83 bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' ); 82 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );84 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 83 85 } 84 86 85 87 $new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0; 86 88 87 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {89 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) { 88 90 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 89 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );91 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 90 92 } 91 93 } … … 104 106 $group_status = 'hidden'; 105 107 106 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {108 if ( ! $bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) { 107 109 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 108 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );110 bp_core_redirect( bp_groups_get_create_url( array( bp_get_groups_current_create_step() ) ) ); 109 111 } 110 112 … … 219 221 } 220 222 221 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . $next_step ) ); 223 $redirect_url = bp_get_groups_directory_url( bp_groups_get_path_chunks( array( $next_step ), 'create' ) ); 224 bp_core_redirect( $redirect_url ); 222 225 } 223 226 } … … 238 241 239 242 bp_core_add_message( $message, $error ); 240 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/group-invites') );243 bp_core_redirect( bp_groups_get_create_url( array( 'group-invites' ) ) ); 241 244 } 242 245
Note: See TracChangeset
for help on using the changeset viewer.