This file contains hidden or 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_validation', 'zeen_ignore_state_for_international', 10, 2); | |
function zeen_ignore_state_for_international($errors, $fields) | |
{ | |
// if the user selects GB (Great Britian), then remove the state validation | |
if ($fields['country'] == 'GB') { | |
unset($errors['state_empty']); |
This file contains hidden or 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_active_campaign_after_new_subscriber', 'zeen_add_custom_field_for_active_campaign', 10, 2 ); | |
function zeen_add_custom_field_for_active_campaign( $user_id, $contact_id ) { | |
$field_id = 1; // retrieved from the admin settings custom fields table | |
$value = sanitize_text_field( $_POST['2_field_8_1'] ); // custom registration field name | |
$api = new Leaky_Paywall_Active_Campaign_Api(); |
This file contains hidden or 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_account_setup_validation', 'zeen_validate_email_blacklist', 20, 2 ); | |
function zeen_validate_email_blacklist($errors, $fields) | |
{ | |
// edit to the domains/strings you would like to block from registering | |
$blacklist = array( | |
'gmail', |
This file contains hidden or 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_before_create_stripe_subscription', 'endo_handle_product_for_recurring_checkout', 20, 2); | |
function endo_handle_product_for_recurring_checkout($customer, $fields) { | |
$stripe = leaky_paywall_initialize_stripe_api(); | |
try { | |
$invoice_item = $stripe->invoiceItems->create([ |
This file contains hidden or 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 | |
// Send an email to the subscriber when Authorize.net sends a net.authorize.customer.subscription.expired webhook event | |
// Notice the action is the event name, with the periods changed out for underscores | |
// Any event can be accessed that way | |
add_action('leaky_paywall_net_authorize_customer_subscription_expired', 'zeen_send_expired_notice', 10, 2); | |
function zeen_send_expired_notice($user, $webhook_data) | |
{ |
This file contains hidden or 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_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); |
This file contains hidden or 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_update_subscriber', 'zeen_update_hubspot_after_sub_update', 10, 5); | |
function zeen_update_hubspot_after_sub_update($user_id, $email, $meta, $customer_id, $meta_args) | |
{ | |
$data['properties']['firstname'] = $meta_args['first_name']; | |
$data['properties']['lastname'] = $meta_args['last_name']; | |
$data['properties']['level_id'] = $meta['level_id']; |
This file contains hidden or 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_hubspot_create_contact_data', 'zeen_add_more_data_to_hubspot', 10, 2); | |
function zeen_add_more_data_to_hubspot( $data, $subscriber_data ) { | |
// get the subscriber's level id | |
$level_id = absint($subscriber_data['level_id']); | |
// Append the level id to the level_id custom property |
This file contains hidden or 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_block_active_sub_to_group', 'endo_add_active_sub_to_group', 10, 2 ); | |
function endo_add_active_sub_to_group($block_active_sub_to_group, $user) { | |
$level_id = leaky_paywall_subscriber_current_level_id( $user ); | |
if ( !is_numeric( $level_id ) ) { |
This file contains hidden or 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('bulk_add_leaky_paywall_subscriber', 'zeen_send_welcome_email_after_import', 10, 2); | |
function zeen_send_welcome_email_after_import($user_id, $meta) | |
{ | |
add_filter('leaky_paywall_send_new_admin_email', fn($status) => false ); // disable admin email from being sent | |
leaky_paywall_email_subscription_status($user_id, 'new', $meta); |
NewerOlder