MemberPress: Limit Phone Number Digits

function mepr_limit_phone_digits( $errors ) { $phone = isset( $_POST[‘mepr_phone_number’] ) ? sanitize_text_field(trim($_POST[‘mepr_phone_number’])) : ”; // Remove all non-numeric characters from the phone number. $phone = preg_replace(“/[^0-9]/”, “”, $phone); // Check if phone digits equal 11 if (strlen($phone) != 11) {…Continue reading

MemberPress: Override Description for All Payment Methods on Click

jQuery(document).ready(function($) { // Listen for a click event on the payment method label $(document).on(‘click’, ‘.mepr-payment-option-label’, function() { // Loop through all payment method description elements and update the text $(‘.mepr-payment-method-desc-text’).each(function() { var $this = $(this); var newText = ‘New text…Continue reading

MemberPress: Allow Coupon for Active Members Only

function mepr_validate_coupon_for_active_members($errors) { $user = new MeprUser(get_current_user_id()); $coupon_code = (isset($_POST[‘mepr_coupon_code’]) && !empty( $_POST[‘mepr_coupon_code’])) ? stripslashes( $_POST[‘mepr_coupon_code’] ) : ”; // Define the coupon code as a constant define( ‘ACTIVE_MEMBER_COUPON’, ‘THECOUPONCODE’ ); // Check if it’s the specific coupon and the…Continue reading

MemberPress: Make VAT field required for Registering EU-based Users

function mepr_cust_limit_eu_signups( $errors ) { $usr_country = sanitize_text_field( $_POST[‘mepr-address-country’] ); $countries = require( MEPR_DATA_PATH.’/taxes/vat_countries.php’ ); //If EU country, but not GB, and no vat number entered, throw error if( array_key_exists( $usr_country, $countries ) && ‘GB’ != $usr_country && !isset( $_POST[‘mepr-vat-number’]…Continue reading