Skip to content

Instantly share code, notes, and snippets.

@New0
New0 / caldera-label-left.css
Last active Jul 3, 2017
Caldera Forms label on left of input
View caldera-label-left.css
/************* Modern version for browsers with flex support https://caniuse.com/#feat=flexbox ********************/
.caldera-grid .form-group {
display: flex;
}
.caldera-grid .form-group label {
width: 25%; /*Set to the width needed by the text of your label */
}
.caldera-grid .form-group > div{
width: 75%; /*Set to the width needed by the text of your input */
}
@New0
New0 / cf-description-above-input.css
Last active Jul 6, 2017
Use CSS flex to display the description field above the input filed in Caldera Forms (Flex support: https://caniuse.com/#feat=flexbox)
View cf-description-above-input.css
/** Add the class desc-above to the field **/
.form-group.cf-desc-above > div {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
}
.caldera-grid .form-group.cf-desc-above .checkbox,
.caldera-grid .form-group.cf-desc-above .radio {
margin-top: -5px;
@New0
New0 / ds_affiliate_manager_action.php
Last active Jul 17, 2017
Send affiliate manager plugin information after Direct Stripe Payment ( UNTESTED )
View ds_affiliate_manager_action.php
function my_direct_stripe_payment_completed( $charge_id, $post_id, $button_id, $user_id ) {
$charge = \Stripe\Charge::retrieve($charge_id);
$user = get_user_by('id', $user_id);
WPAM_Logger::log_debug('Stripe Payments Integration – asp_stripe_payment_completed hook triggered.');
//Required Parameters
$amount = $charge->amount;
$purchaseAmount = number_format( $amount , '2' );//Sale Amount
$order_id = $charge->id;//Transaction ID
$buyer_email = $user->user_email;//Email address
@New0
New0 / ds_update_source.php
Last active Aug 12, 2017
WAIT FOR UPDATE TO 2.1.0 DIrect Stripe Update Customer's Card Number in Stripe
View ds_update_source.php
add_filter( 'ds_charge_action_payment', function( $action ) {
$action = '\Stripe\Customer::retrieve';
return $action;
}, 10);
add_filter( 'ds_charge_content_payment', function( $content, $token, $stripe_id ) {
@New0
New0 / ds-shortcode-in-template.php
Created Aug 17, 2017
Insertion of Direct Stripe shortcode in template files
View ds-shortcode-in-template.php
//Allow the Direct Stripe assets to be enqueued in chosen pages
add_action( 'wp', function () {
global $post;
$shortcodePageSlugs = array(
'hello-world',
'second-page-slug'
);
if( $post )
View keybase.md

Keybase proof

I hereby claim:

  • I am new0 on github.
  • I am newo (https://keybase.io/newo) on keybase.
  • I have a public key whose fingerprint is 0CB0 252B D558 F443 6494 8D2F B6B1 6DAF 7034 C7CE

To claim this, I am signing this object:

@New0
New0 / direct_stripe_success_user_email_content.php
Created Sep 7, 2017
direct_stripe_success_user_email_content filter hook example
View direct_stripe_success_user_email_content.php
add_filter( 'direct_stripe_success_user_email_content', function( $message, $token, $amount, $currency, $email_address, $description, $user_id, $button_id){
$message = 'User ' . $email_address . ' have been charged ' . $amount . $currency . ' for ' . $description;
return $message;
}, 10, 8 );
@New0
New0 / hide-cf-label.css
Created Sep 11, 2017
Hide Caldera Forms options from a Checkbox field generated by/for setting Mailchimp Groups.
View hide-cf-label.css
label[for="fld_1774775_1_0"] { /* Replace fld_1774775_1_0 with the actual label "for" parameter */
display: none;
}
@New0
New0 / ds_send_new_user_credentials.php
Created Sep 17, 2017
Send login credentials to user after sucessful Direct Stripe notification
View ds_send_new_user_credentials.php
add_action( 'direct_stripe_before_success_redirection', function( $chargeID, $post_id, $button_id, $user_id ) {
wp_new_user_notification( $user_id, null, 'both' );
}, 10, 4 );
@New0
New0 / DS-no-margins.css
Created Sep 28, 2017
Remove margin arround Direct Stripe button
View DS-no-margins.css
.direct-stripe { margin: 0; }
You can’t perform that action at this time.