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_userdata_before_user_create', function( $user_data ) { | |
| // Check if a level_id is available in the registration data. | |
| // Adjust the level ID and role to match your setup. | |
| if ( isset( $_POST['level_id'] ) && '0' === $_POST['level_id'] ) { | |
| $user_data['role'] = 'free_subscriber'; | |
| } | |
| return $user_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 fields to the gift form | |
| add_action('lp_gift_sub_after_recipient_fields', 'endo_add_custom_fields_on_gift_form' ); | |
| function endo_add_custom_fields_on_gift_form() { | |
| ?> | |
| <p> | |
| <label>Your coworking space</label> |
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 fields to registration form | |
| add_action('leaky_paywall_after_password_registration_field', 'endo_custom_tos_registration_fields', 100, 2); | |
| function endo_custom_tos_registration_fields($level_id, $level) | |
| { | |
| // do not show on free levels | |
| if ( $level['price'] == 0 ) { | |
| return; |
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_shortcode('endo_user_purchased_downloads', function () { | |
| if (! is_user_logged_in()) { | |
| return '<p>Please log in to see your downloads.</p>'; | |
| } | |
| $user_id = get_current_user_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 | |
| // 1. content_matches_restriction_exceptions | |
| public function content_matches_restriction_exceptions() { | |
| $cache_key = 'lp_restriction_exception_' . $this->post_id; | |
| if ( false === ( $match = get_transient( $cache_key ) ) ) { |
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([ |
NewerOlder