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 | |
add_action ('admin_init', 'zeen_restore_level_by_id' ); | |
function zeen_restore_level_by_id() { | |
$settings = get_leaky_paywall_settings(); | |
$level_id = 1; // the id of the level you want to restore | |
$settings['levels'][$level_id]['deleted'] = 0; // this will "undelete" the level |
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 | |
add_filter('leaky_paywall_cancel_subscription_description', 'endo_change_cancel_description' ); | |
function endo_change_cancel_description( $description ) { | |
$new_description = '<p>Please click the first link below to cancel your subscription.</p>'; | |
return $new_description; | |
} |
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 | |
// add toc field to registration form | |
add_action('leaky_paywall_after_password_registration_field', 'zeen_custom_tos_registration_fields'); | |
function zeen_custom_tos_registration_fields() | |
{ | |
?> | |
<div class="form-row"> | |
<input style="display: inline;" type="checkbox" required id="tos" name="tos"> <label for="tos" style="display: inline;">I understand I will be automatically billed on my renewal date unless I cancel, and I agree to all <a target="_blank" href="<?php echo home_url('subscription-terms'); ?>">terms and conditions</a>.</label> |
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 | |
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 ) { |
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 | |
add_filter( 'leaky_paywall_subscribe_or_login_message', 'zeen_hide_nag', 20, 4 ); | |
function zeen_hide_nag( $new_content, $message, $content, $post_id ) { | |
// return either original content or an empty string | |
// return $content; | |
return ''; |
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 | |
add_filter( 'leaky_paywall_userdata_before_user_create', 'zeen_lp_use_different_role' ); | |
function zeen_lp_use_different_role( $userdata ) { | |
$userdata['role'] = 'digital_subscriber'; | |
return $userdata; | |
} |
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 | |
add_filter('leaky_paywall_subscribe_or_login_message', 'zeen101_custom_subscribe_content', 10, 4 ); | |
function zeen101_custom_subscribe_content( $new_content, $message, $content, $post_id ) { | |
$settings = get_leaky_paywall_settings(); | |
$lead_in = str_replace( $message, '', $new_content); | |
$subscribe_nag = '<div class="leaky_paywall_message_wrap"><div id="leaky_paywall_message">'; |
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 | |
add_filter('leaky_paywall_subscribe_or_login_message', 'zeen101_custom_subscribe_content', 10, 4 ); | |
function zeen101_custom_subscribe_content( $new_content, $message, $content, $post_id ) { | |
$thumbnail = get_the_post_thumbnail(); | |
return '<p>' . $content . '</p>' . $thumbnail . $message; | |
} |
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 | |
add_filter( 'leaky_paywall_level_id_for_simplecirc_subscriber', 'zeen_set_level_id_by_price', 20, 2 ); | |
function zeen_set_level_id_by_price( $level_id, $subscriber ) { | |
if ( !isset( $subscriber->subscriptions[0]->last_order->amount_paid ) ) { | |
return 1; | |
} |
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 | |
add_action( 'template_redirect', 'zeen101_custom_redirects' ); | |
function zeen101_custom_redirects() { | |
if ( !is_category() ) { | |
return; | |
} |