Skip to content

Instantly share code, notes, and snippets.

@New0
New0 / cf-render-notice-data.php
Created Mar 20, 2020
Print data from the Caldera Forms submission the the render notice
View cf-render-notice-data.php
<?php
/**
* Plugin Name: CF Render Notice data
* Description: Filter Caldera Forms render notice data and use data from the form submission.
* Author: New0 Nico Figueira
*/
add_filter( 'caldera_forms_render_notices', function( $notices ){
//Set the correct corresponding field ID we want the data from/
@New0
New0 / cf_custom_featured_cf2.php
Last active Mar 17, 2020
Set a featured image via an advanced file field 2.0 and Save as post type processor in Caldera Forms.
View cf_custom_featured_cf2.php
@New0
New0 / cf-check-filetype-error.php
Last active Mar 4, 2020
For Caldera Forms, check filetype errors and prevent page navigation if detected
View cf-check-filetype-error.php
<?php
/**
* Plugin Name: CF File Error On Page Nav
* Description: Check if a File Type error is displayed during Next page button click and prevents navigation if found.
* Author: New0
*/
// Add jQuery to document footer
add_action('wp_footer', function(){
?>
@New0
New0 / cf-dynamic-braintree-plans.php
Last active Mar 4, 2020
Dynamic plans in Braintree processor for Caldera Forms.
View cf-dynamic-braintree-plans.php
<?php
/**
* Plugin Name: CF Dynamic Braintree Plans
* Description: Set a different Braintree Plan ID based on a fields value, using one Braintree processor
* Author: New0
*/
/* Create a Dropdown select field and set the values of each otpion with the ID of a Braintree Plan. T
Then copy and paste this dropdown select field in the code below */
@New0
New0 / cf-remove-tags-entry-csv-export.php
Last active Mar 11, 2020
Remove HTML Tags from the Entry data exported to CSV from admin
View cf-remove-tags-entry-csv-export.php
<?php
/**
* Plugin Name: CF Remove CSV Html
* Description: This Removes the HTML tags from the entries data exported to CSV file
*/
add_filter('caldera_forms_admin_csv', function( $csv_data, $form){
//Uncomment and set the correct Form ID to target a precise Form
//if($form['ID'] === 'CF5d6f65f0e87f4'){
foreach( $csv_data['data'] as $entry_ID => $entry ){
if(is_array($entry) === true){
@New0
New0 / cf-html5pattern-example.php
Created Feb 19, 2020
Set an html5 pattern on a Caldera Forms field
View cf-html5pattern-example.php
<?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;
@New0
New0 / cf-remove-backslash.php
Last active Feb 14, 2020
Remove backslash from parsed data of bracket magic tags in Caldera Forms
View cf-remove-backslash.php
<?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);
@New0
New0 / cf-set-browser-details.php
Created Feb 6, 2020
Set the browser details "HTTP_USER_AGENT" in a Caldera Forms hidden field
View cf-set-browser-details.php
<?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'];
@New0
New0 / cf-stripe-pi-description.php
Last active Jan 30, 2020
Display a description for the payment on the Stripe interface. Requires Caldera Forms Stripe add-on
View cf-stripe-pi-description.php
<?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
@New0
New0 / cf-caldera_forms_field_attributes-ssn-pattern.php
Created Jan 7, 2020
Social security number pattern for Caldera Forms single line text fields
View cf-caldera_forms_field_attributes-ssn-pattern.php
<?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}';
}
You can’t perform that action at this time.