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-set-custom-error-notices.php
Created Oct 14, 2019
Set custom error messages during custom Caldera Forms process
View cf-set-custom-error-notices.php
<?php
//Unset success message and set a different error message for admin users and others
add_filter('caldera_forms_render_notices', function ($notices) {
//Unset success message
unset($notices['success']['note']);
//Set error message for admins
if ( current_user_can('administrator') ) {
@New0
New0 / cf-force-process-state.php
Last active Oct 10, 2019
Force process state, start spinner and deactivate fields on submit button click for Caldera Forms.
View cf-force-process-state.php
<?php
/*
* Plugin Name: CF Force process state
* Description: Force process state, start spinner and deactivate fields.
*/
add_filter('wp_footer', function(){
echo '<script type="text/javascript">
jQuery(".caldera-grid input[type=\'submit\']").on("click", function() {
var form = jQuery(this).parent("form");
@New0
New0 / cf-paragraph-settings.php
Last active Sep 20, 2019
Plugin to set the maxlength to multiple Caldera Forms paragraphs fields
View cf-paragraph-settings.php
<?php
/**
* Plugin Name: CF paragraph settings
*
*/
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field, $form ){
//Set the field IDs here
$fields = [ 'fld_456', 'fld_457', 'fld_458' ];
@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 / cf-entries-as-user-meta-data.php
Created Jun 11, 2019
Save CF new form entries as user meta data and display a list of these entries linked to a modal form filled with entry
View cf-entries-as-user-meta-data.php
<?php
/*
* Plugin Name: CF entries as user meta data
* Description: Save entries as USER metadata, display list of entries for a user to see / edit them
* Author: New0
*/
/**
* On form submit, associate new entries to USER
*/
@New0
New0 / ds-cross-border-classification.php
Last active Mar 31, 2019
Add-on for Direct Stripe in order to declare the Cross Border Classification as metadata in payments and subscriptions
View ds-cross-border-classification.php
<?php
/*
* Plugin Name: DS Cross Border Classification
* Author: Nicolas Figueira
* Author URI: https://newo.me
* Description: Declare Cross Border Classification during Direct Stripe transactions
* Plugin URI: https://gist.github.com/New0/69100a1d6ba749c0e15d03cef9a4481b/edit
* Version: 1.0.0
*/
function ds_cbc($data, $user, $token, $button_id) {
@New0
New0 / ds-spinner.php
Last active Mar 9, 2019
Change Direct Stripe spinner animation
View ds-spinner.php
<?php
/* Custom Direct Stripe spinner animation */
add_filter( 'direct_stripe_processing_transaction_spinner', function( $html, $begin, $end, $text, $dots, $instance){
return '<div id="loadingDS-' . $instance . '" class="loadingDS-container loader" style="display:none;"></div>';
}, 10, 6);
@New0
New0 / ds-charge-metadata.php
Last active Mar 6, 2019
Add metadata parameter to Direct Stripe charge
View ds-charge-metadata.php
<?php
/*
* Add metadata parameter to the Direct Stripe button
*/
add_action( 'direct_stripe_charge_data', function($data, $user, $token, $button_id) {
$data[] = array(
"metadata" => array(
"key" => "value"
)
@New0
New0 / ds-currency-code.php
Last active Feb 28, 2019
Add currency code after Direct Stripe donation input field
View ds-currency-code.php
<?php
/*
* Plugin Name: DS currency code
* Description: Add currency code after Direct Stripe donation input field
* Version: 0.0.1
* Author: Nicolas Figueira
* Author URI: https://newo.me
*/
add_filter( 'direct_stripe_donation_input', function( $direct_stripe_donation_input, $instance, $button_id ) {
if( $button_id === 'euros-button' ){ // Edit with the CSS ID of button in euros
You can’t perform that action at this time.