Last active
October 27, 2019 09:28
-
-
Save New0/ffeb19410601e952d368aba3dbdf4674 to your computer and use it in GitHub Desktop.
To be installed as a plugin - Filter Emails sent by Direct Stripe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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