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 | |
/* two actions | |
leaky_paywall_stripe_invoice_payment_succeeded | |
leaky_paywall_stripe_payment_intent_succeeded | |
*/ | |
add_action( 'leaky_paywall_stripe_invoice_payment_succeeded', 'zeen_send_renewal_email_notification', 10, 2 ); | |
function zeen_send_renewal_email_notification( $user, $stripe_object ) { |
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_basic_shipping_countries', 'zeen_us_and_canada_only' ); | |
function zeen_us_and_canada_only( $countries ) { | |
$new_countries = array( | |
'US' => 'United States', | |
'CA' => 'Canada' | |
); |
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_set_expiration_date', 'zeen_set_exp_to_hour', 20, 3 ); | |
function zeen_set_exp_to_hour( $expires, $data, $user_id ) { | |
return date_i18n( 'Y-m-d H:i:s', strtotime( '1 hour') ); | |
} |
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_create_recurring_customer', 'zeen101_add_fee_to_recurring_checkout'); | |
function zeen101_add_fee_to_recurring_checkout( $customer ) { | |
$fee_amount = 999; // in cents | |
$stripe = leaky_paywall_initialize_stripe_api(); |
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_simplecirc_gift_giver_data', 'zeen_add_gift_giver_data_to_simplecirc', 10, 2 ); | |
function zeen_add_gift_giver_data_to_simplecirc( $data, $gift_details ) { | |
if ( isset( $gift_details['gift_giver_address'])) { | |
$data['address_1'] = $gift_details['gift_giver_address']; | |
} |
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( 'lp_gift_subs_details_array', 'zeen_save_gift_giver_address' ); | |
function zeen_save_gift_giver_address( $data ) { | |
if ( isset( $_POST['gift_giver_address'] ) ) { | |
$data['gift_giver_address'] = sanitize_text_field( $_POST['gift_giver_address'] ); | |
} |
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( 'lp_gift_sub_after_billing_fields', 'zeen_gift_giver_address_fields'); | |
function zeen_gift_giver_address_fields() { | |
?> | |
<h3>Gift Giver Address</h3> | |
<p class="form-row address-field"> | |
<label>Address <i class="required">*</i></label> | |
<input type="text" value="" name="gift_giver_address" placeholder="House number and street name" required=""> |
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_simplecirc_subscriber_data', 'zeen_tester_add_phone'); | |
function zeen_tester_add_phone( $data ) | |
{ | |
// this is the name of the field generated by the Leaky Paywall Custom Registration Fields add-on. | |
// Please change the field name to whatever is being used in your own custom field for phone number. | |
if ( !isset($_POST['0_field_1_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 | |
// adjust who can edit and manage the Leaky Paywall settings menu | |
// use WordPress capabilities https://wordpress.org/support/article/roles-and-capabilities/ | |
add_filter( 'manage_leaky_paywall_settings', 'zeen101_adjust_lp_setting_management' ); | |
function zeen101_adjust_lp_setting_management( $cap ) { | |
// allow editors | |
return 'delete_others_posts'; |
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('wp', 'zeen_redirect_if_no_access'); | |
function zeen_redirect_if_no_access() | |
{ | |
$restricted_page_id = 79791; | |
$settings = get_leaky_paywall_settings(); |