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 / 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 / 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) {
@New0
New0 / ds-custom-code.php
Created Nov 29, 2018
Custom WordPress plugin used as an extension of Direct Stripe Plugin
View ds-custom-code.php
<?php
/*
* Plugin Name: DS custom code
* Author: Nicolas Figueira
* Description: Direct Stripe custom actions and filters
* Plugin URI: https://gist.github.com/New0/d72217de1e60871cf938715c2fd03b61
*
* This code is an add-on of Direct Stripe WordPress plugin
*/
@New0
New0 / ds-activate-trial.php
Last active Oct 19, 2018
Activate Trial_from_plan = true in Direct Stripe subscription button
View ds-activate-trial.php
<?php
/*
* Plugin Name: DS Activate Trial
* Author: Nicolas Figueira
* Description: Add Activate Trial acttribute for a Direct Stripe Subscription button
* Plugin URI: https://gist.github.com/New0/9044c5e50732883342f844c5b7fb7b85
*
* This code is an add-on of Direct Stripe WordPress plugin
*/
add_action( 'direct_stripe_subscription_data', function($subscriptiondata, $user, $token, $button_id, $plan_id, $coupon, $description) {
@New0
New0 / ds-edit-tc-link.php
Created Oct 1, 2018
Edit the T&C text and link of a Direct Stripe button
View ds-edit-tc-link.php
@New0
New0 / ds-filter-params-amount.php
Last active Oct 5, 2018
Set the amount of a Direct Stripe button based on a variable available on page load
View ds-filter-params-amount.php
<?php
/*
* The 'ds_filter_params' filter hook is available since Direct Stripe 2.1.8
*
* We want to set the amount based on a query parameter sent on the previous page, (or any variable available on page load)
* We called the query variable ds_amount
*/
add_filter( 'ds_filter_params', function( $params ){
if( $params['button_id'] === 'MyButtonID' ) { //EDIT 'MyButtonID' with your own CSS Button ID
@New0
New0 / ds-custom-code-how-to.md
Last active Sep 23, 2018
Add a description to the Charge event triggered by a Direct Stripe Subscription
View ds-custom-code-how-to.md

How to add a description to a charge triggered by a subscription of Direct Stripe WordPress plugin plugin

First steps from your Stripe dashboard

  • Log in the Stripe Dashboard

  • Add a webhook endpoint in Developers -> Webhooks -> ( Add endpoint ) button

You can’t perform that action at this time.