function bp_is_group_creation_step( $step_slug ) { global $bp; /* Make sure we are in the groups component */ if ( $bp->current_component != BP_GROUPS_SLUG || 'create' != $bp->current_action ) return false; /* If this the first step, we can just accept and return true */ if ( !$bp->action_variables[1] && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug ) return true; /* Before allowing a user to see a group creation step we must make sure previous steps are completed */ if ( !bp_is_first_group_creation_step() ) { if ( !bp_are_previous_group_creation_steps_complete( $step_slug ) ) return false; } /* Check the current step against the step parameter */ if ( $bp->action_variables[1] == $step_slug ) return true; return false; }
function bp_is_group_creation_step($step_slug) { global $bp; /* Make sure we are in the groups component */ if (!bp_is_groups_component() || !bp_is_current_action('create')) { return false; } /* If this the first step, we can just accept and return true */ $keys = array_keys($bp->groups->group_creation_steps); if (!bp_action_variable(1) && array_shift($keys) == $step_slug) { return true; } /* Before allowing a user to see a group creation step we must make sure previous steps are completed */ if (!bp_is_first_group_creation_step()) { if (!bp_are_previous_group_creation_steps_complete($step_slug)) { return false; } } /* Check the current step against the step parameter */ if (bp_is_action_variable($step_slug)) { return true; } return false; }
function myfossil_group_creation_tabs() { global $bp; if (!is_array($bp->groups->group_creation_steps)) { return false; } if (!bp_get_groups_current_create_step()) { $keys = array_keys($bp->groups->group_creation_steps); $bp->groups->current_create_step = array_shift($keys); } foreach ((array) $bp->groups->group_creation_steps as $slug => $step) { $is_enabled = bp_are_previous_group_creation_steps_complete($slug); $selected = bp_get_groups_current_create_step() == $slug; if ($selected) { $tpl = '<li class="current active selected">'; } else { $tpl = "<li>"; } if ($is_enabled) { $tpl .= sprintf('<a href="%s/%s/create/step/%s">%s</a>', bp_get_root_domain(), bp_get_groups_root_slug(), $slug, $step['name']); } else { $tpl .= sprintf('<a>%s</a>', $step['name']); } $tpl .= "</li>"; print $tpl; } unset($is_enabled); do_action('groups_creation_tabs'); }