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_stripe_invoice_payment_succeeded', 'mysite_send_stripe_renewal_thank_you', 10, 2 ); | |
| function mysite_send_stripe_renewal_thank_you( $user, $invoice ) { | |
| if ( empty( $invoice->billing_reason ) || 'subscription_cycle' !== $invoice->billing_reason ) { | |
| 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 | |
| // this requires an edu email address to sign up for the level. Can be changed to whatever the requirements are. | |
| // front end check | |
| add_filter('leaky_paywall_account_setup_validation', function ($errors, $fields) { | |
| $edu_level_id = '6'; | |
| if (isset($fields['level_id']) && $edu_level_id === $fields['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_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(); |
NewerOlder