Skip to content

Instantly share code, notes, and snippets.

View New0's full-sized avatar

Nico Figueira Mahe New0

View GitHub Profile
@New0
New0 / cf-set-custom-currency.php
Created February 27, 2018 15:44
Set Caldera Forms Paypal express currency conditionally with a dropdown select field.
<?php
add_filter( 'cf_paypal_request', function( $request, $process, $form ) {
//SET THE FORM ID AND THE FIELD ID ( DROPDOWN FIELD WITH CURRENCY OPTIONS )
$form_id = 'CF5a5e8452c6f82';
$field_id = 'fld_8085538';
if ( $form['ID'] === $form_id ) {
if ( $process['data'][$field_id] === 'USD' ) {
$request[ 'PAYMENTREQUEST_0_CURRENCYCODE' ] = 'USD';
@New0
New0 / cf-paypal-canceled-email.php
Created February 28, 2018 09:47
Caldera Forms Paypal express process, send an email when a user cancels a Paypal express payment
<?php
add_action( 'caldera_forms_redirect_preprocess', function( $url, $form, $process_id ){
//Change the Form ID
if( $form['ID'] === 'CF5a5e8452c6f82' ) {
//Set the recipient the sbuject and the message
$recipient = '[email protected]';
$subject = 'My Email Subject';
$message = 'My Email content';
@New0
New0 / cf-redirection-new-window.php
Last active March 15, 2022 08:05
Caldera Forms redirection processor using window.location to open a new window
<?php
/**
* Plugin Name: CF custom redirection
* Description: Customization for the Caldera Forms redirect processor.
* Version: 0.0.1
* Author: New0
* Author URI: https://github.com/New0
*/
add_action('caldera_forms_redirect', function($type, $url, $form){
@New0
New0 / cf-stripe-error-email.php
Created March 2, 2018 12:31
Send email when Stripe payment with Caldera Forms failed after process
<?php
add_action( 'caldera_forms_redirect', function( $type, $url, $form ){
//Change the Form ID
if( $form['ID'] === 'CF5a5e8452c6f82' ) {
//Set the recipient the sbuject and the message
$recipient = '[email protected]';
$subject = 'My Email Subject';
$message = 'My Email content';
global $transdata;
$form['mailer']['recipients'] = $recipient;
@New0
New0 / cf-disble-input.php
Created March 2, 2018 13:56
Disable input field Caldera Forms using caldera_forms_field_attributes filter hook
<?php
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field ){
//Change fld_2910574 with the correct ID of the field
if( 'fld_2910574' === $field[ 'ID' ] ) {
$attrs[ 'disabled' ] = "disabled";
}
return $attrs;
@New0
New0 / cf-segment-mailchimp-users.php
Last active March 2, 2018 16:35
Caldera Forms segment Mailchimp users
<?php
add_filter( 'cf_mailchimp_request_data', function( $request_data, $config, $form ){
//EDIT THE FORM ID
if( $form['ID'] === 'CF5a5e8452c6f82' ) {
global $transdata;
//EDIT THE FORM ID
if( $transdata['data']['fld_6071068'] === 'field_value' ) {
@New0
New0 / ds-custom-data.php
Created March 11, 2018 20:43
Custom plugin to send custom data from a text area after transaction success with Direct Stripe
<?php
/*
* Plugin Name: Direct Stripe custom hooks
* Author: Nicolas Figueira
*
*/
//Add a textarea before the button
add_action( 'direct_stripe_before_button', function() {
?>
@New0
New0 / CF-save-data-as-ACF-Google-map-field.php
Last active March 22, 2018 14:28
Save Caldera Forms data as an Advanced Custom Field Google Map Field.
<?php
/*
* Transform data from file field and update gallery custom field
* Documentation at -- https://gist.github.com/New0/10fd66ccf144930b69d28781e90fc689#file-cf-to-acf-google-map-field-md --
*
*/
add_action( 'caldera_forms_submit_complete', function( $form, $referrer, $process_id, $entryid ) {
//change your form ID here
if( 'CF5a5e8452c6f82' != $form[ 'ID' ] ) {
return;
@New0
New0 / ds-custom-button.php
Created June 30, 2018 09:32
Custom plugin to filter Direct Stripe button markup
<?php
/*
* Plugin Name: Direct Stripe Custom Button
*/
//Set Styles settings not to use custom or Stripe styles
//Filters added in Direct Stripe 2.1.5 ( List of Actions and filters https://newo.me/direct-stripe-actions-and-filters-hooks/ )
add_filter('direct_stripe_div_before', function( $div, $button_id, $class ){
if( $button_id !== 'MyButtonID'){ //Set a Button ID in the Button Settings to target only this Button