MemberPress: Restrict Email Patterns for All Memberships

function mepr_restrict_email_patterns_for_all_plans($errors) { // Define the patterns to search for in email addresses $blocked_email_patterns = array( ‘xxx@gmail’, ‘xyz@’, ‘test@test’ ); // Retrieve the email address from the form submission $email_address = isset( $_POST[ ‘user_email’ ] ) ? sanitize_email( trim( $_POST[…Continue reading

MemberPress: Restrict Email Domains on Registration

function mepr_restrict_email_domains($errors) { # Allowed email domains. $allowed_email_domains = array(‘gmail.com’, ‘hotmail.com’); $email_address = isset($_POST[‘user_email’]) ? sanitize_email(trim($_POST[‘user_email’])) : ”; # Don’t bother validating if the email is empty. if(empty($email_address)) { return $errors; } $user_email_array = explode(‘@’, $email_address); $user_email_domain = array_pop($user_email_array); #…Continue reading

MemberPress: Send Tax (e.g. VAT) to Stripe

add_action(‘mepr_stripe_create_customer_args’, function ($args, $usr) { $vat = sanitize_text_field($_REQUEST[‘mepr_vat_number’]); //Check one more time to make sure we have a vat number if (isset($vat) && !empty($vat)) { $tax_id = array( “type” => “eu_vat”, //Replace the “eu_vat” value with the predefined value of…Continue reading

MemberPress: Disable Reminders if a Member has Any Active Subscription

add_filter(‘mepr-sub-expires-reminder-disable’, function ($disable_email, $reminder, $usr, $prd) { $active_product_subscriptions = $usr->active_product_subscriptions(‘ids’); // Disable reminders if member has any active subscription. if(!empty($active_product_subscriptions)) { $disable_email = true; } return $disable_email; }, 10, 4);Continue reading

MemberPress: Dynamic Trial Periods

//Sets up a trial period on MemberPress such that ALL users renew on March 31st. function mepr_days_until($date){ return (isset($date)) ? floor((strtotime($date) – time())/60/60/24) : false; } function mepr_update_mepr_trial_period() { $prd = new MeprProduct(123); //CHANGE 123 to the ID of your…Continue reading