Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save greenhornet79/085b4be2c9305ee4e515f4e33b2bc3a4 to your computer and use it in GitHub Desktop.
Save greenhornet79/085b4be2c9305ee4e515f4e33b2bc3a4 to your computer and use it in GitHub Desktop.
<?php
add_filter('leaky_paywall_new_email_message', 'zeen_maybe_update_email_message', 99, 2);
function zeen_maybe_update_email_message($message, $user_id) {
$user = get_user_by( 'ID', $user_id );
$transaction_id = leaky_paywall_get_transaction_id_from_email( $user->user_email );
$transaction = get_post($transaction_id);
$level_id = get_post_meta( $transaction_id, '_level_id', true );
$price = get_post_meta($transaction_id, '_price', true);
$level = get_leaky_paywall_subscription_level($level_id);
$html = '<table style="width: 100%"><tr><td><strong>Subscription to ' . $level['label'] . '</strong></td><td align="right"><strong>Sub total $' . $price . '</strong></td></tr></table>';
$html .= '<hr>';
$html .= '<table style="width: 100%"><tr><td>Total Tax</td><td align="right">$0.00</td></tr></table>';
$html .= '<hr>';
$html .= '<table style="width: 100%"><tr><td><strong>Total</strong></td><td align="right"><strong>$' . $price . '</strong></td></tr></table>';
$html .= '<p>Paid on ' . date( 'M d, Y', strtotime($transaction->post_date) ) . '</p>';
return $message . $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment