Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Last active May 22, 2020 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericnicolaas/60277d2b75ea10719b8ef324c1728364 to your computer and use it in GitHub Desktop.
Save ericnicolaas/60277d2b75ea10719b8ef324c1728364 to your computer and use it in GitHub Desktop.
Add "Waiver Agreement" fields to campaign form on initial submission
<?php
add_filter(
'charitable_campaign_submission_fields',
function( $fields, $form ) {
$waiver_fields = array(
'legend' => 'Liability Waiver and Release',
'type' => 'fieldset',
'fields' => array(
'waiver' => array(
'type' => 'paragraph',
'priority' => 1,
'fullwidth' => true,
'content' => 'My Waiver',
'editable' => false,
),
'waiver_agreement' => array(
'label' => 'I read and agree to the liability waiver.',
'type' => 'checkbox',
'value' => 1,
'priority' => 2,
'required' => true,
'checked' => $form->get_campaign_value( 'waiver_agreement' ),
'data_type' => 'meta',
'fullwidth' => true,
'editable' => false,
),
)
);
$waiver_fields = $form->filter_non_editable_fields( $waiver_fields );
if ( ! empty( $waiver_fields['fields'] ) ) {
$fields['waiver_fields'] = $waiver_fields;
}
return $fields;
},
10,
2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment