MemberPress: Add Membership Titles To the Top of Registration Pages
add_action(‘wp_footer’, function() { if (is_singular(‘memberpressproduct’)) { echo ‘ ‘ . get_the_title() . ‘ ‘; ?>Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action(‘wp_footer’, function() { if (is_singular(‘memberpressproduct’)) { echo ‘ ‘ . get_the_title() . ‘ ‘; ?>Continue reading
/** * MemberPress – Exclude Specific Custom Fields from Signup Forms * * This code hides selected custom fields on MemberPress registration forms * when a specific URL parameter is present. */ add_filter( ‘mepr_render_custom_fields’, function( $fields ) { global $post;…Continue reading
function limit_signups_to_excluded_regions( $errors ) { // Check if the country field is set If ( isset( $_POST[ ‘mepr-address-country’ ] ) ) { $country = sanitize_text_field( wp_unslash( $_POST[ ‘mepr-address-country’ ] ) ); // Exclude EU countries if ( $country == ‘US’…Continue reading
function limit_signups_to_excluded_regions( $errors ) { // List of EU country codes $eu_countries = array( ‘AT’, ‘BE’, ‘BG’, ‘HR’, ‘CY’, ‘CZ’, ‘DK’, ‘EE’, ‘FI’, ‘FR’, ‘DE’, ‘EL’, ‘HU’, ‘IE’, ‘IT’, ‘LV’, ‘LT’, ‘LU’, ‘MT’, ‘NL’, ‘PL’, ‘PT’, ‘RO’, ‘SK’, ‘SI’, ‘ES’,…Continue reading
function limit_signups_to_excluded_regions($errors) { // Check if the country field is set if ( isset( $_POST[ ‘mepr-address-country’ ] ) ) { $country = sanitize_text_field( wp_unslash( $_POST[ ‘mepr-address-country’ ] ) ); // Exclude Northern Ireland under UK country code if( $country ==…Continue reading
// CHANGE this array – should be a comma separated list of Membership ID’s to apply the signup codes to $GLOBALS[‘free_memberships_require_coupon’] = array(123); function make_coupon_mandatory_free_membership($errors) { if(!isset($_POST[‘mepr_coupon_code’]) || trim($_POST[‘mepr_coupon_code’]) == ” && in_array($_POST[‘mepr_product_id’], $GLOBALS[‘free_memberships_require_coupon’])) { $errors[] = ‘A valid coupon…Continue reading
function mepr_restrict_email_patterns_for_specific_plans($errors) { // Define the patterns to search for in email addresses $blocked_email_patterns = array( ‘xxx@gmail’, ‘xyz@’, ‘test@test’ ); // Define specific subscription plan IDs that require email restriction $restricted_plan_ids = array( 123, 456 ); // Replace with actual…Continue reading
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
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
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