Skip to content

Instantly share code, notes, and snippets.

View greenhornet79's full-sized avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
<?php
function zeen101_redirect_user_after_login_by_level( $user_login, $user ) {
$mode = leaky_paywall_get_current_mode();
$level_id = get_user_meta( $user->ID, '_issuem_leaky_paywall_' . $mode . '_level_id', true );
if ( $level_id == 0 ) {
wp_redirect( home_url('sales-partner-portal') );
exit();
@greenhornet79
greenhornet79 / gist:d7e7ecc60f3711fa3bf5446c74037392
Last active February 18, 2019 23:41
leaky-paywall-custom-mailchimp-merge-fields
<?php
add_filter( 'leaky_paywall_mailchimp_merge_fields', 'zeen101_custom_mailchimp_merge_fields', 10, 2 );
function zeen101_custom_mailchimp_merge_fields( $merge_fields, $email ) {
$mode = leaky_paywall_get_current_mode();
$user = get_user_by( 'email', $email );
if ( !$user ) {
<script>
( function( $ ) {
$(document).ready( function() {
$('.leaky-paywall-payment-button a').text('Register');
});
})( jQuery );
</script>
<?php
/**
* Change the word "Post" to "Article" in the Leaky Paywall - Article Countdown Nag add-on
*/
add_filter( 'leaky_paywall_acn_countdown_remaining_text', 'zeen101_change_countdown_remaining_text', 10, 2 );
function zeen101_change_countdown_remaining_text( $remaining_text, $post_id ) {
return str_replace( 'Post', 'Article', $remaining_text );
}
<?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 ) {
$location = sanitize_text_field( $_POST['location'] );
if ( $location ) {
$customer_array['metadata'] = array(
'location' => $location,
<?php
add_filter( 'leaky_paywall_filter_is_restricted', 'zeen101_allow_access_for_category', 10, 3 );
function zeen101_allow_access_for_category( $is_restricted, $restriction_settings, $post_id ) {
if ( !is_single( $post_id ) ) {
return $is_restricted;
}
<?php
add_filter( 'leaky_paywall_filter_is_restricted', 'zeen101_check_meter_bypass', 10, 3 );
function zeen101_check_meter_bypass( $is_restricted, $restriction_settings, $post_id ) {
$bypass_value = 'utm_source=My+Site';
$referrer = $_SERVER['HTTP_REFERER'];
if ( $referrer ) {
<?php
$terms = get_terms( array(
'taxonomy' => 'issuem_issue',
'hide_empty' => false,
) );
$num = 4;
shuffle( $terms );
<?php
add_action( 'leaky_paywall_after_update_stripe_subscription', 'zeen101_charge_proration_after_upgrade', 10, 3 );
function zeen101_charge_proration_after_upgrade( $cu, $sub, $level ) {
$invoice_items = \Stripe\InvoiceItem::all(["limit" => 3]);
foreach( $invoice_items->data as $item ) {
<?php
add_action( 'leaky_paywall_cancelled_subscriber', 'zeen101_send_admin_cancel_notification_email', 10, 2 );
function zeen101_send_admin_cancel_notification_email( $user, $gateway ) {
$mode = leaky_paywall_get_current_mode();
$level_id = get_user_meta( $user->ID, '_issuem_leaky_paywall_' . $mode . '_level_id', true );
$levels = leaky_paywall_get_levels();