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["line_items"][0][ "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 | |
//this applies change when creating plans | |
add_filter( 'cf_stripe_recurring_args', 'my_cf_stripe_recurring_filter', 10, 2 ); | |
//this applies change when creating one time payments | |
add_filter( 'cf_stripe_charge_args', 'my_cf_stripe_single_filter', 10, 2 ); | |
//this is the callback to change arguments sent to API | |
//Be careful not to set a field that isn't supported or the API will reject the charge. | |
//Description for single payments |
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 | |
/** | |
* Plugin Name: CF Show Pro UI | |
* Description: Show Caldera Forms pro settings | |
* Author: Caldera Forms | |
**/ | |
//Force Pro settings to show | |
add_filter('caldera_forms_show_pro_ui', '__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 | |
/* | |
* This will allow a user with ID 2 to view the entry viewer even without the manage_optiuons capability | |
* REPLACE 2 by the correct user ID | |
*/ | |
add_filter('caldera_forms_manage_cap', function( $cap, $context, $form ){ | |
if( is_user_logged_in() ){ | |
$user_id = get_current_user_id(); |
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 | |
/* | |
* Validates fields only using a Social security number pattern like 999-99-999 | |
* EDIT FIELDS IDS TO BE VALIDATED "fld_5675945", "fld_1648505" | |
*/ | |
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field, $form ){ | |
$fields = ["fld_5675945", "fld_1648505"]; | |
if( in_array( $field['ID'], $fields ) ){ | |
$attrs[ 'pattern' ] = '^\d{3}-\d{2}-\d{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 | |
/* | |
* Plugin Name: CF Stripe Payment description | |
* Author: Nicolas Figueira | |
* Descriptipon: Display the description in the payments on the Stripe dashboard | |
* | |
*/ | |
add_filter( 'cf_stripe_charge_args', function( $args, $config, $form ){ | |
//The description can also be set to be different from the processor's settings |
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 | |
/* | |
* Set the HTTP_USER_AGENT as the value of a hidden field during submission | |
* In this case the hidden field ID is fld_7526079, that needs to be edited | |
*/ | |
add_filter( 'caldera_forms_process_field_hidden', function( $value, $field ) { | |
//Change your field ID here | |
if( $field['ID'] === "fld_7526079" ){ | |
$value = $_SERVER['HTTP_USER_AGENT']; |
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 | |
/* | |
* This is very basic, you may want to target a precise $form, $magics or type of $value using conditions. | |
*/ | |
add_filter( 'caldera_forms_do_field_bracket_value', function($value, $magics, $entry_id, $form ){ | |
return implode("",explode("\\",$value)); | |
}, 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 | |
/* | |
* HTML5 Pattern to limiot input field to 8 alphanumeric (only capitals) characters | |
*/ | |
add_filter( 'caldera_forms_field_attributes', function($attrs, $field){ | |
//IMPORTANT - Change your field ID | |
if ( 'fld_1234' === $field[ 'ID'] ) { | |
$attrs[ 'pattern' ] = '[A-Z0-9]{8}'; | |
} | |
return $attrs; |