Skip to content

Instantly share code, notes, and snippets.

Nicolas Figueira New0

Block or report user

Report or block New0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@New0
New0 / caldera_forms_api_allow_entry_view-1.php
Last active Oct 18, 2019 — forked from Shelob9/caldera_forms_api_allow_entry_view-1.php
Code examples for caldera_forms_api_allow_entry_view filter to change who can see Caldera Forms front-end entry viewer and corresponding REST API endpoint
View caldera_forms_api_allow_entry_view-1.php
<?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;
}
@New0
New0 / caldera_forms_field_attributes-add-attr.php
Last active Sep 19, 2019 — forked from Shelob9/caldera_forms_field_attributes-add-attr.php
Examples of how to use the Caldera Forms filter caldera_forms_field_attributes to modify Caldera Forms input elements. See: https://calderaforms.com/doc/caldera_forms_field_attributes/
View caldera_forms_field_attributes-add-attr.php
<?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 );
View cf-stripe-change-charge-amount.php
<?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 );
@New0
New0 / caldera_forms_submit_post_process-get-and-change.php Example code for action that runs after Caldera Forms submission is processed, but before it is saved. For more information see: https://calderaforms.com/doc/caldera_forms_submit_post_process/
View caldera_forms_submit_post_process-get-and-change.php
<?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' )) ){
@New0
New0 / track-entry-id-by-user.php
Last active Sep 13, 2018 — forked from Shelob9/track-entry-id-by-user.php
Track Caldera Forms entry ID in user meta so form can be used as editor for previous submission https://calderaforms.com/doc/edit-caldera-forms-entries/
View track-entry-id-by-user.php
<?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;
You can’t perform that action at this time.