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 / 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}';
}
@New0
New0 / cf-user-entry-viewer.php
Created Jan 7, 2020
Allow a precise user to read form the caldera forms entry viewer
View cf-user-entry-viewer.php
<?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();
@New0
New0 / cf-show-pro-ui.php
Last active Dec 24, 2019
Show Pro settings in Caldera Forms if disconnected ( this can be activated as a WordPress plugin using the Download Zip button )
View cf-show-pro-ui.php
<?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');
View cf-stripe-change-description.php
<?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
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["line_items"][0][ "amount" ] = 1000;
return $args;
}, 10, 4 );
@New0
New0 / cf-limit-option-submissions.php
Created Dec 9, 2019
Use cf_entry_limiter_entry_limit filter hook for select fields with multiple choices allowed
View cf-limit-option-submissions.php
<?php
/**
* Allow different field values of same field to have different limits when using Caldera Forms Entry Limitter
*
* Requires version 1.2.0 or later
*/
add_filter( 'cf_entry_limiter_entry_limit', function( $limit, $entry, $field, $form ){
//IMPORTANT: Change fld_9970286 to your field's ID
if( 'fld_9970286' === $field[ 'ID' ] ){
//IMPORTANT: Use the field values (not labels) in these conditionals
@New0
New0 / cf-tabindex-radio-options.php
Last active Nov 19, 2019
//Example of adding a tabindex to radio fields options in Caldera Forms
View cf-tabindex-radio-options.php
<?php
/**
* Plugin Name: CF tabindex on radio options
* Autor: New0
* Description: Add tabindex on options of radio fields in CF
*/
//Example of adding a tabindex to radio fields options in Caldera Forms
// If there are multiple radio fields on same page, target each field using the field ID between caldera-grid and radio classes.
//Like ".caldera-grid #fld_8471527_1-wrap .radio label input" replacing #fld_8471527 by the field ID ( and keeping _1-wrap attached).
@New0
New0 / cf-custom-code.php
Created Nov 8, 2019
Replace text in CF Connected Forms buttons
View cf-custom-code.php
<?php
/*
* Plugin Name: CF custom code
* Author: New0
* Description: Force connected Submit button text if translation didn't apply
*/
add_action('wp_footer', function() {
?>
<script type="text/javascript">
@New0
New0 / cf-allow-all-viewers.php
Last active Nov 1, 2019
Allow all users (non logged-in) to view the Caldera Forms entry for a prcise form.
View cf-allow-all-viewers.php
<?php
/*
* Plugin Name: CF allow all viewers
* Author: New0
* Description: Allow all requests to read entries of form with ID CF5c78740daac4a
*/
/**
* For API endpoint that powers front-end entry viewer.
*/
@New0
New0 / DS-filter-emails.php
Last active Oct 27, 2019
To be installed as a plugin - Filter Emails sent by Direct Stripe
View DS-filter-emails.php
<?php
/*
* Plugin Name: Direct Stripe Filter Emails
* Description: Filter Emails sent by Direct Stripe
* Author: New0
* Author URI: https://newo.me/
* Version: 0.0.1
*/
add_filter( 'direct_stripe_success_user_email_content', function( $message, $amount, $currency, $email_address, $description, $user, $button_id ){
You can’t perform that action at this time.