MemberPress: Send “Profile Updated” Admin Notification

function user_profile_update( $user_id ) { $site_url = get_bloginfo( ‘wpurl’ ); $user_info = get_userdata( $user_id ); $user_name = $user_info->display_name; //Retrieves user’s full name $user_email = $user_info->user_email; //Retrieves user’s e-mail address $subject = “Profile Updated: “.$site_url.””; $message = “Profile of $user_name ,…Continue reading

MemberPress: Send Email to User When Their User Role Is Changed

function mepr_email_user_role_change( $user_id, $new_role ) { $site_url = get_bloginfo( ‘wpurl’ ); $user_info = get_userdata( $user_id ); $to = $user_info->user_email; $subject = “Your role has changed: “.$site_url; // Email Subject $message = “Hello ” .$user_info->display_name . “, your role has changed…Continue reading

Copyright & Current Year Shortcodes

/** * Returns the current year. * * @return string Current year in YYYY format. */ function get_current_year() { return date(‘Y’); } /** * Shortcode to display the current year. * * @return string HTML span with current year. */…Continue reading

MemberPress: Whitelist Domains

function mepr_custom_is_domain_whitelisted() { $whitelist = array( “domain.com, domain1.com” ); //comma-separated list of domains $domain = parse_url( $_SERVER[ ‘HTTP_REFERER’ ], PHP_URL_HOST ); if ( !empty($domain ) && in_array( $domain, $whitelist ) ) { return true; //Exclude from paywall } return false;…Continue reading

MemberPress: Turn Off Auto-Rebill for Offline Gateway

//Turn off Auto rebill for offline gateway if a transactions expires function turn_off_auto_rebill_offline_gateway( $txn, $sub_status ) { if ( $txn->payment_method() instanceof MeprArtificialGateway && $sub = $txn->subscription() ) { $sub->status = MeprSubscription::$cancelled_str; $sub->store(); } } add_action( ‘mepr-transaction-expired’, ‘turn_off_auto_rebill_offline_gateway’, 9, 2 );…Continue reading

MemberPress: Change Non-Recurring Renewal Price

function mepr_change_product_renewal_price( $product_price, $coupon_code, $product ) { $user = new MeprUser( get_current_user_id() ); $subscriptions = $user->active_product_subscriptions( ‘ids’, true, true ); // change the 123 ID to the required one-time membership ID if ( $product->ID === 123 && in_array( $product->ID, $subscriptions…Continue reading