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
add_action(‘wp_head’, function() { ?>Continue reading
function mepr_remove_states( $states ) { return array( ‘US’ => array( ‘BU’ => _x( ‘Fake State’, ‘ui’, ‘memberpress’ ) ) ); } add_filter( ‘mepr_states’, ‘mepr_remove_states’, 20, 2 );Continue reading
function limit_signups_to_one_country( $errors ) { // Check if the country field is set and if the country is not UK if( !isset( $_POST[‘mepr-address-country’] ) || $_POST[‘mepr-address-country’] != ‘GB’ ) { $errors[] = ‘Sorry, signups are currently limited to UK only.’;…Continue reading
function mepr_custom_limit_signups_by_state( $errors ) { $usr_country = sanitize_text_field( $_POST[‘mepr-address-country’] ); $usr_state = sanitize_text_field( $_POST[‘mepr-address-state’] ); $exclude_states = array(‘AK’); //Change this as needed or you can do a comma seperated list of state abbr. //If state in excluded list throw error…Continue reading
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
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
/** * Block login after 3 failed attempts. */ function block_login_after_three_attempts() { $login_lockout = get_option( ‘login_lockout’, array() ); // Get the user’s IP address. $user_ip = $_SERVER[‘REMOTE_ADDR’]; // Check if the user’s IP address is already in the lockout array.…Continue reading
add_filter(‘frm_data_sort’, ‘frm_remove_duplicates’, 21, 2); function frm_remove_duplicates( $options, $atts ) { if ( $atts[‘dynamic_field’][‘id’] == 100) { //change 100 to the ID of the Dynamic field $options = array_unique( $options ); } return $options; }Continue reading