Changeset 5941
- Timestamp:
- 03/23/2012 06:01:28 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-template.php
r5927 r5941 1625 1625 $bp_classes[] = 'group-admin'; 1626 1626 1627 if ( bp_is_group_create() ) 1627 if ( bp_is_group_create() ) { 1628 1628 $bp_classes[] = 'group-create'; 1629 $bp_classes[] = bp_get_groups_current_create_step(); 1630 } 1629 1631 1630 1632 if ( bp_is_group_home() ) -
trunk/bp-groups/bp-groups-actions.php
r5729 r5941 35 35 // If no current step is set, reset everything so we can start a fresh group creation 36 36 $bp->groups->current_create_step = bp_action_variable( 1 ); 37 if ( ! $bp->groups->current_create_step) {37 if ( !bp_get_groups_current_create_step() ) { 38 38 unset( $bp->groups->current_create_step ); 39 39 unset( $bp->groups->completed_create_steps ); … … 47 47 48 48 // If this is a creation step that is not recognized, just redirect them back to the first screen 49 if ( !empty( $bp->groups->current_create_step ) && empty( $bp->groups->group_creation_steps[$bp->groups->current_create_step] ) ) {49 if ( bp_get_groups_current_create_step() && empty( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()] ) ) { 50 50 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 51 51 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/' ); … … 66 66 67 67 // Check the nonce 68 check_admin_referer( 'groups_create_save_' . $bp->groups->current_create_step);69 70 if ( 'group-details' == $bp->groups->current_create_step) {68 check_admin_referer( 'groups_create_save_' . bp_get_groups_current_create_step() ); 69 70 if ( 'group-details' == bp_get_groups_current_create_step() ) { 71 71 if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) { 72 72 bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' ); 73 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $bp->groups->current_create_step. '/' );73 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' ); 74 74 } 75 75 … … 78 78 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' ) ) ) { 79 79 bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' ); 80 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $bp->groups->current_create_step. '/' );80 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' ); 81 81 } 82 82 … … 85 85 } 86 86 87 if ( 'group-settings' == $bp->groups->current_create_step) {87 if ( 'group-settings' == bp_get_groups_current_create_step() ) { 88 88 $group_status = 'public'; 89 89 $group_enable_forum = 1; … … 105 105 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 ) ) ) { 106 106 bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' ); 107 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $bp->groups->current_create_step. '/' );107 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' ); 108 108 } 109 109 … … 116 116 } 117 117 118 if ( 'group-invites' == $bp->groups->current_create_step)118 if ( 'group-invites' == bp_get_groups_current_create_step() ) 119 119 groups_send_invites( bp_loggedin_user_id(), $bp->groups->new_group_id ); 120 120 121 do_action( 'groups_create_group_step_save_' . $bp->groups->current_create_step);121 do_action( 'groups_create_group_step_save_' . bp_get_groups_current_create_step() ); 122 122 do_action( 'groups_create_group_step_complete' ); // Mostly for clearing cache on a generic action name 123 123 … … 128 128 */ 129 129 $completed_create_steps = isset( $bp->groups->completed_create_steps ) ? $bp->groups->completed_create_steps : array(); 130 if ( !in_array( $bp->groups->current_create_step, $completed_create_steps ) )131 $bp->groups->completed_create_steps[] = $bp->groups->current_create_step;130 if ( !in_array( bp_get_groups_current_create_step(), $completed_create_steps ) ) 131 $bp->groups->completed_create_steps[] = bp_get_groups_current_create_step(); 132 132 133 133 // Reset cookie info … … 137 137 // If we have completed all steps and hit done on the final step we 138 138 // can redirect to the completed group 139 if ( count( $bp->groups->completed_create_steps ) == count( $bp->groups->group_creation_steps ) && $bp->groups->current_create_step== array_pop( array_keys( $bp->groups->group_creation_steps ) ) ) {139 if ( count( $bp->groups->completed_create_steps ) == count( $bp->groups->group_creation_steps ) && bp_get_groups_current_create_step() == array_pop( array_keys( $bp->groups->group_creation_steps ) ) ) { 140 140 unset( $bp->groups->current_create_step ); 141 141 unset( $bp->groups->completed_create_steps ); … … 157 157 */ 158 158 foreach ( (array) $bp->groups->group_creation_steps as $key => $value ) { 159 if ( $key == $bp->groups->current_create_step) {159 if ( $key == bp_get_groups_current_create_step() ) { 160 160 $next = 1; 161 161 continue; … … 173 173 174 174 // Group avatar is handled separately 175 if ( 'group-avatar' == $bp->groups->current_create_step&& isset( $_POST['upload'] ) ) {175 if ( 'group-avatar' == bp_get_groups_current_create_step() && isset( $_POST['upload'] ) ) { 176 176 if ( !empty( $_FILES ) && isset( $_POST['upload'] ) ) { 177 177 // Normally we would check a nonce here, but the group save nonce is used instead -
trunk/bp-groups/bp-groups-template.php
r5930 r5941 1994 1994 return false; 1995 1995 1996 if ( ! $bp->groups->current_create_step)1996 if ( !bp_get_groups_current_create_step() ) 1997 1997 $bp->groups->current_create_step = array_shift( array_keys( $bp->groups->group_creation_steps ) ); 1998 1998 … … 2002 2002 $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?> 2003 2003 2004 <li<?php if ( $bp->groups->current_create_step== $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php echo bp_get_root_domain() . '/' . bp_get_groups_root_slug() ?>/create/step/<?php echo $slug ?>/"><?php else: ?><span><?php endif; ?><?php echo $counter ?>. <?php echo $step['name'] ?><?php if ( $is_enabled ) : ?></a><?php else: ?></span><?php endif ?></li><?php2004 <li<?php if ( bp_get_groups_current_create_step() == $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php echo bp_get_root_domain() . '/' . bp_get_groups_root_slug() ?>/create/step/<?php echo $slug ?>/"><?php else: ?><span><?php endif; ?><?php echo $counter ?>. <?php echo $step['name'] ?><?php if ( $is_enabled ) : ?></a><?php else: ?></span><?php endif ?></li><?php 2005 2005 $counter++; 2006 2006 } … … 2014 2014 global $bp; 2015 2015 2016 echo apply_filters( 'bp_group_creation_stage_title', '<span>— ' . $bp->groups->group_creation_steps[ $bp->groups->current_create_step]['name'] . '</span>' );2016 echo apply_filters( 'bp_group_creation_stage_title', '<span>— ' . $bp->groups->group_creation_steps[bp_get_groups_current_create_step()]['name'] . '</span>' ); 2017 2017 } 2018 2018 … … 2192 2192 } 2193 2193 2194 /** 2195 * Echoes the current group creation step 2196 * 2197 * @since 1.6 2198 */ 2199 function bp_groups_current_create_step() { 2200 echo bp_get_groups_current_create_step(); 2201 } 2202 /** 2203 * Returns the current group creation step. If none is found, returns an empty string 2204 * 2205 * @since 1.6 2206 * 2207 * @uses apply_filters() Filter bp_get_groups_current_create_step to modify 2208 * @return str $current_create_step 2209 */ 2210 function bp_get_groups_current_create_step() { 2211 global $bp; 2212 2213 if ( !empty( $bp->groups->current_create_step ) ) { 2214 $current_create_step = $bp->groups->current_create_step; 2215 } else { 2216 $current_create_step = ''; 2217 } 2218 2219 return apply_filters( 'bp_get_groups_current_create_step', $current_create_step ); 2220 } 2221 2194 2222 function bp_is_last_group_creation_step() { 2195 2223 global $bp; … … 2197 2225 $last_step = array_pop( array_keys( $bp->groups->group_creation_steps ) ); 2198 2226 2199 if ( $last_step == $bp->groups->current_create_step)2227 if ( $last_step == bp_get_groups_current_create_step() ) 2200 2228 return true; 2201 2229 … … 2208 2236 $first_step = array_shift( array_keys( $bp->groups->group_creation_steps ) ); 2209 2237 2210 if ( $first_step == $bp->groups->current_create_step)2238 if ( $first_step == bp_get_groups_current_create_step() ) 2211 2239 return true; 2212 2240
Note: See TracChangeset
for help on using the changeset viewer.