This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow all requests to read entries of form with ID CF123567 | |
* | |
* For API endpoint that powers front-end entry viewer. | |
*/ | |
add_filter( 'caldera_forms_api_allow_entry_view', function( $allowed, $form_id, WP_REST_Request $request ){ | |
if( 'CF123567' === $form_id ){ | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field, $form ){ | |
if( 'button' === Caldera_Forms_Field_Util::get_type( $field, $form ) ){ | |
$attrs[ 'data-form-id' ] = $form[ 'ID' ]; | |
} | |
return $attrs; | |
}, 20, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change Caldera Forms Stripe Payment Amount | |
*/ | |
add_filter( 'cf_stripe_charge_args', function( $args, $config, $form ){ | |
//change charge amounts to $10. Amount is in cents. | |
$args[ 'amount' ] = 1000; | |
return $args; | |
}, 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'caldera_forms_submit_post_process', function( $form, $referrer, $process_id, $entry_id ){ | |
//make sure to set your field ID here. | |
$field_id = 'fld_123456'; | |
//Get value of a field | |
$field_value = Caldera_Forms::get_field_data( $field_id, $form , $entry_id); | |
//check value | |
if( in_array( $field_value, array( 'Roy', 'Shawn' )) ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* On form load, check for a saved entry for current user | |
*/ | |
add_filter( 'caldera_forms_render_entry_id', function ( $entry_id, $form ){ | |
//change form ID to match your form | |
if( 'CF1234567' == $form[ 'ID' ] && get_current_user_id() ){ | |
$saved_entry_id = get_user_meta( get_current_user_id(), 'form_entry_id' ); | |
if( 0 < absint( $saved_entry_id ) ){ | |
$entry_id = $saved_entry_id; |