Skip to content

Instantly share code, notes, and snippets.

@New0 New0/DS-filter-emails.php
Last active Oct 27, 2019

Embed
What would you like to do?
To be installed as a plugin - Filter Emails sent by Direct Stripe
<?php
/*
* Plugin Name: Direct Stripe Filter Emails
* Description: Filter Emails sent by Direct Stripe
* Author: New0
* Author URI: https://newo.me/
* Version: 0.0.1
*/
add_filter( 'direct_stripe_success_user_email_content', function( $message, $amount, $currency, $email_address, $description, $user, $button_id ){
$message = 'User ' . $email_address . ' have been charged ' . $amount . $currency . ' for ' . $description;
return $message;
}, 10, 7 );
add_filter( 'direct_stripe_success_admin_email_content', function( $message, $amount, $currency, $email_address, $description, $user, $button_id ){
$today = date("j, n, Y");
$user_info = get_user_by('email', $email_address);
$user_email = $user_info->user_email;
$message = '<h1>TEXT – somesite.ru</h1><br/>' .
'http://' . $_SERVER['HTTP_HOST'] . '<br/>' .
'TEXT – ' . $email_address . '<br/>' .
'TEXT- ' . number_format( $amount/100, 2) . $currency . '<br/>' .
'TEXT – ' . $description . '<br/>' .
'TEXT – ' . $today . '<br/>' .
'TEXT – ' . print_r($user_info) . '<br/>';
$message .= 'User – ' . $user_email . '<br/>';
return $message;
}, 10, 7 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.