Skip to content

Instantly share code, notes, and snippets.

View greenhornet79's full-sized avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
@greenhornet79
greenhornet79 / leaky-paywall-subscriber-table-custom-fields.php
Created June 16, 2017 12:19
Add custom fields to the Leaky Paywall subscriber table with filters
<?php
add_filter( 'leaky_paywall_subscribers_columns', 'zeen101_add_column_for_custom_field' );
add_filter( 'manage_leaky_paywall_subscribers_custom_column', 'zeen101_add_data_to_custom_field_column', 10, 3 );
function zeen101_add_column_for_custom_field( $columns ) {
$columns['zeen101_custom_field'] = 'Zeen101 Custom Field';
return $columns;
@greenhornet79
greenhornet79 / leaky-paywall-vat.php
Created July 14, 2017 19:15
add basic VAT abilities to Leaky Paywall
add_action( 'leaky_paywall_before_registration_form', 'omg_show_vat_on_subscription_details' );
function omg_show_vat_on_subscription_details( $level ) {
$vat_price = omg_calculate_vat_total( $level['price'] );
echo '<p><strong>With VAT Tax: </strong> ' . leaky_paywall_get_current_currency_symbol() . $vat_price . '</p>';
}
<?php
add_filter( 'leaky_paywall_login_form_args', 'zeen101_login_referrer_redirect' );
function zeen101_login_referrer_redirect( $args ) {
$referrer = $_SERVER['HTTP_REFERER'];
if ( !$referrer ) {
<?php
add_action( 'leaky_paywall_failed_payment', 'zeen101_send_payment_failed_notification' );
function zeen101_send_payment_failed_notification( $user ) {
$to = $user->user_email;
$subject = 'Your payment has failed';
$body = 'We are sorry to inform you that your attempt at payment has failed. Please <a href="https://examplesite.com/my-account/">log in to your account</a> on Example Site and update your credit card information.';
$headers = array('Content-Type: text/html; charset=UTF-8','From: Example Site <[email protected]>');
@greenhornet79
greenhornet79 / leaky-paywall-customer-metadata-stripe.php
Created September 27, 2017 16:13
Add metadata when creating a Stripe Customer in Leaky Paywall
<?php
add_filter( 'leaky_paywall_process_stripe_payment_customer_array', 'zeen101_add_meta_to_stripe_customer' );
function zeen101_add_meta_to_stripe_customer( $customer_array ) {
$customer_array['metadata'] = array(
'company_name' => 'name of company',
'company_billing_address' => 'billing address',
);
@greenhornet79
greenhornet79 / login-form-shortcode.php
Created December 4, 2017 16:54
login for shortcode for WordPress
<?php
function login_form_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'redirect' => ''
), $atts ) );
if (!is_user_logged_in()) {
<?php
add_action( 'leaky_paywall_failed_payment', 'zeen101_send_payment_failed_notification' );
function zeen101_send_payment_failed_notification( $user ) {
$to = $user->user_email;
$subject = 'Your payment to XXXX Publication has failed';
$body = 'We are sorry to inform you that your attempt at payment for XXXX Publication has failed. Please <a href="https://yourdomain.com/my-account/">log in to your account</a> on XXXX Publication and update your credit card information.';
<?php
add_filter( 'leaky_paywall_new_email_message', 'zeen101_per_level_email_message', 10, 2 );
function zeen101_per_level_email_message( $message, $user_id ) {
$mode = leaky_paywall_get_current_mode();
$level_id = get_user_meta( $user_id, '_issuem_leaky_paywall_' . $mode . '_level_id', true );
<?php
add_filter( 'leaky_paywall_content_access_description', 'zeen101_adjust_content_access_description', 10, 3 );
function zeen101_adjust_content_access_description( $content_access_description, $level, $level_id ) {
switch ( $level_id ) {
case 0:
$output = '<ul>';
$output .= '<li>Gold Benfit #1</li>';