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-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
@New0
New0 / ds-input-coupon.php
Last active May 23, 2019
Draft for Direct Stripe input coupons field
View ds-input-coupon.php
<?php
/*
* Plugin Name: Direct Stripe input coupons
* Author: Nicolas Figueira
* Description: Allow users to use promotional coupons with Direct Stripe
* Version: 0.0.1
* Text Domain: ds-coupons
*
* This is not production ready
* It will add an input field for coupon with CSS ID button_with_coupon
@New0
New0 / cf-disabled-options.php
Last active Jan 27, 2019
Caldera Forms. Add disabled attribute to options in Checkbox, Dropdown and Select 2 fields
View cf-disabled-options.php
<?php
//Example of how to use a Disabled attribute for options in Checkbox, dropdown or select 2 fields
add_filter( 'caldera_forms_render_get_field', function( $field ) {
if( 'fld_4425558' === $field[ 'ID' ] ){ //Field ID => 'fld_4425558'
$field[ 'config' ][ 'option' ]['opt1996332']['disabled'] = true; // Option ID => 'opt1996332'
} else if( 'fld_7668742' === $field[ 'ID' ] ){ //Field ID => 'fld_7668742'
$field[ 'config' ][ 'option' ]['opt3137985']['disabled'] = true; // Option ID => 'opt3137985'
} else if( 'fld_381620' === $field[ 'ID' ] ){ //Field ID => 'fld_381620'
$field[ 'config' ][ 'option' ]['opt1172954']['disabled'] = true; // Option ID => 'opt1172954'
}
@New0
New0 / ds-disable-gutenberg-block.php
Last active Jan 19, 2019
Example use of filter to disable the Gutenberg block of Direct Stripe
View ds-disable-gutenberg-block.php
<?php
/**
* Plugin Name: Disable Direct Stripe Gutenberg Block
* Description: Disable Direct Stripe Gutenberg Block
* Version: 1.0.0
* Author: Nicolas Figueira
* Author URI: https://newo.me
*
* This can be loaded as a plugin -> Download ZIP and from the WordPress adin go to Plugins -> Add Plugin and Click the Upload Plugin button to upload this zip and activate the plugin
*
@New0
New0 / ds-plan-based-on-donation-amount.php
Last active Jan 9, 2019
Subscribe a user to a plan based on a donation amount with Direct Stripe.
View ds-plan-based-on-donation-amount.php
<?php
/*
* Plugin Name: DS custom code
* Description: Create subscriptions based on donation amount
* Author: Nicolas Figueira
* Version: 0.0.1
*
* To use this as a plugin :
* – Edit the code with the css ID you set for your button
* – Zip the file
@New0
New0 / mockUtils.js
Last active Dec 18, 2018
mocUtils for render files field
View mockUtils.js
//https://gist.github.com/josephhanson/372b44f93472f9c5a2d025d40e7bb4cc
function MockFile() {
};
MockFile.prototype.create = function (name, size, mimeType) {
name = name || "mock.txt";
size = size || 1024;
mimeType = mimeType || 'plain/txt';
function range(count) {
You can’t perform that action at this time.