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

MemberPress: Require Coupon at Checkout

function mepr_must_fill_out_coupon_code( $errors ) { if( !isset($_POST[‘mepr_coupon_code’]) || empty($_POST[‘mepr_coupon_code’] ) ) { $errors[] = “You must fill out the Coupon code field before registering.”; } return $errors; } add_filter( ‘mepr-validate-signup’, ‘mepr_must_fill_out_coupon_code’, 11, 1 );Continue reading

MemberPress: Disable Admin Password Lost/Changed Email

function mepr_disable_admin_pw_changed_email( $recipients, $subject, $message, $headers ) { if( strpos( $subject, ‘Password Lost/Changed’ ) !== false ) { $recipients = array(); // no recipients } return $recipients; } add_filter( ‘mepr-wp-mail-recipients’, ‘mepr_disable_admin_pw_changed_email’, 11, 4 );Continue reading

MemberPress: Hide Protected Posts on Archive Page

function mepr_exclude_protected_posts_from_archive( $query ) { if( !$query->is_admin && $query->is_archive() && $query->is_main_query() ) { $posts_to_exclude = array(); $posts = get_posts( array( ‘numberposts’ => -1 ) ); foreach( $posts as $post ) { if( MeprRule::is_locked( $post ) ) { $posts_to_exclude[] = $post->ID;…Continue reading

MemberPress: Hide Protected Posts from Search Results

function mepr_exclude_protected_posts_from_search( $query ) { if( !$query->is_admin && $query->is_search && $query->is_main_query() ) { $posts_to_exclude = array(); $posts = get_posts( array( ‘post_type’ => get_post_types(), ‘numberposts’ => -1 )); foreach( $posts as $post ) { if( MeprRule::is_locked( $post ) ) { $posts_to_exclude[]…Continue reading