Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
Unchecks some registration fields by default.
Browse files Browse the repository at this point in the history
Adds a key labeled `checked` with a value of `false` to some of the registration
fields so they are not checked by default in the settings form. Specific
fields, per comment by @amandafrench:

* Technology skill level.
* T-shirt size
* Children

Fixes #62.
  • Loading branch information
Jeremy Boggs committed Aug 13, 2013
1 parent df4e3b6 commit 240e57a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions thatcamp-registrations-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function thatcamp_registrations_fields( $type = 'limited' ) {
'value' => 'advanced',
'text' => __( 'Advanced (can code)', 'thatcamp-registrations' ),
),
),
),
'checked' => false
),
array(
'id' => 'tshirt_size',
Expand Down Expand Up @@ -171,13 +172,15 @@ function thatcamp_registrations_fields( $type = 'limited' ) {
'value' => 'womens_xxl',
'text' => __( 'Women\'s XXL - Chest 45-47', 'thatcamp-registrations' ),
),
),
),
'checked' => false
),
array(
'id' => 'children',
'name' => __( 'Children', 'thatcamp-registrations' ),
'explanation' => __( 'Kids are welcome! Let us know how many you plan to bring.', 'thatcamp-registrations' ),
'public' => false,
'public' => false,
'checked' => false
),
);

Expand Down Expand Up @@ -205,7 +208,12 @@ function thatcamp_registrations_selected_fields() {
$selected = get_option( 'thatcamp_registrations_selected_fields' );

if ( '' == $selected ) {
$fields = thatcamp_registrations_fields( 'all' );
$fields = thatcamp_registrations_fields( 'all' );
foreach ($fields as $key => $field) {
if($field['checked'] === false) {
unset($fields[$key]);
}
}
$selected = wp_list_pluck( $fields, 'id' );
}

Expand Down

0 comments on commit 240e57a

Please sign in to comment.