MemberPress: Remove all but nine countries from the drop-down

function mepr_remove_countries( $countries, $prioritize_my_country ) { return array( ‘AU’ => _x( ‘Australia’, ‘ui’, ‘memberpress’ ), ‘CA’ => _x( ‘Canada’, ‘ui’, ‘memberpress’ ), ‘DK’ => _x( ‘Denmark’, ‘ui’, ‘memberpress’ ), ‘FR’ => _x( ‘France’, ‘ui’, ‘memberpress’ ), ‘DE’ => _x( ‘Germany’,…Continue reading

MemberPress: Add Author Custom Bio Shortcode

function mpcs_author_custom_bio_shortcode( $atts ) { if( !isset( $atts[‘slug’] ) || empty( $atts[‘slug’] ) ) { return; } global $post; $field = get_user_meta( $post->post_author, $atts[‘slug’], true ); if( empty( $field ) ) { return; } return ‘ ‘ . sanitize_text_field( $field…Continue reading

MemberPress: Dynamic Trail Periods

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( 4480 ); //CHANGE 123 to the ID of your Membership…Continue reading

MemberPress: MailChimp Feed Unblocker

function mepr_allow_mc_through( $block, $post, $uri ) { if( isset( $_GET[ ‘allow_mailchimp’ ] ) ) { $block = false; } return $block; } add_filter( ‘mepr-pre-run-rule-content’, ‘mepr_allow_mc_through’, 11, 3 );Continue reading

MemberPress: Add Category Exception to All Post Rule

function mepr_override_protection( $protect, $post ) { if( has_category( ‘category_slug_here’, $post ) ) { $protect = false; } return $protect; } function mepr_override_content_protection( $protect, $post, $uri ) { return mepr_override_protection( $protect, $post ); } function mepr_override_redirection_protection( $protect, $uri, $delim ) {…Continue reading

Add a color picker field in Formidable Forms

function frm_default_custom_scripts( $scripts ){ $scripts->add( ‘iris’, ‘/wp-admin/js/iris.min.js’, array( ‘jquery-ui-draggable’, ‘jquery-ui-slider’, ‘jquery-touch-punch’ ), ‘1.1.1’, 1 ); $scripts->add( ‘wp-color-picker’, “/wp-admin/js/color-picker.js”, array( ‘iris’ ), false, 1 ); $scripts->set_translations( ‘wp-color-picker’ ); $custom_css = ‘.frm-color-picker .button.wp-color-result{border-radius: var(–border-radius) !important}’ . ‘.frm-color-picker .wp-picker-container{position:relative}’ . ‘.frm-color-picker .wp-picker-clear, .frm-color-picker…Continue reading

MemberPress: Require Specific Coupon to Register

function mepr_only_with_coupon( $errors ) { $membership_id = 123; //Change this ID to your membership ID $coupons = array( ‘IMRECOMMENDED’, ‘DISCOUNTED’ ); //Change these titles to your coupon title(s) if( $_POST[‘mepr_product_id’] == $membership_id ) { if( !isset( $_POST[‘mepr_coupon_code’] ) || empty(…Continue reading