function redirect_non_access_users_to_donation_page() { // Check if we are on a singular page and it’s not the admin area if (!is_admin() && is_singular()) { global $post; // Check if the current user has access to the post if (function_exists(‘pmpro_has_membership_access’)) { $has_access…Continue reading
function custom_single_page_role_based_redirection() { // Check if not in the admin section and the user is on a page if (is_admin() || !is_page()) { return; } // Member roles for this specific redirection $member_roles = [‘silverdonator’, ‘golddonator’, ‘platinumdonator’, ‘titanium_donator’]; // Non-member…Continue reading
function pmpro_admin_access_override($hasaccess, $post, $user, $levels) { // Check if the current user has the ‘administrator’ role if (current_user_can(‘administrator’)) { // Grant access return true; } // Return the original access decision for non-admins return $hasaccess; } add_filter(‘pmpro_has_membership_access_filter’, ‘pmpro_admin_access_override’, 10, 4);Continue reading
// WC – limit one course at a time (id 45639 / Fundamentals Private Networks) add_filter( ‘woocommerce_add_to_cart_validation’, ‘wc_limit_one_45639_per_order’, 10, 2 ); function wc_limit_one_45639_per_order( $passed_validation, $product_id ) { if ( 45639 !== $product_id ) { return $passed_validation; } if ( WC()->cart->get_cart_contents_count()…Continue reading
// WC – limit one course at a time (id 50697 / Fundamentals Public Safety) add_filter( ‘woocommerce_add_to_cart_validation’, ‘wc_limit_one_50697_per_order’, 10, 2 ); function wc_limit_one_50697_per_order( $passed_validation, $product_id ) { if ( 50697 !== $product_id ) { return $passed_validation; } if ( WC()->cart->get_cart_contents_count()…Continue reading
// add order suffix add_filter(‘woe_get_order_value_order_number’, ‘suffix_order_id_for_product_50697’, 10, 2 ); function suffix_order_id_for_product_50697( $order_id, $order ) { // Check if the order contains the specified product $product_id_to_check = 50697; $order_contains_product = false; foreach ( $order->get_items() as $item_id => $item ) { if…Continue reading
// add order suffix add_filter(‘woe_get_order_value_order_number’, ‘suffix_order_id_for_product_45639’, 10, 2 ); function suffix_order_id_for_product_45639( $order_id, $order ) { // Check if the order contains the specified product $product_id_to_check = 45639; $order_contains_product = false; foreach ( $order->get_items() as $item_id => $item ) { if…Continue reading
// WC – avoid other items to be added to cart when a specific product category (free courses) is already in cart add_filter( ‘woocommerce_add_to_cart_validation’, ‘check_and_limit_cart_free_items’, 10, 3 ); function check_and_limit_cart_free_items ( $passed, $product_id, $quantity ){ // HERE set your product…Continue reading
/** * Change Membership Level on Cancellation or Expiration * * Change the Level ID on line 30 to the level you want members to have assigned * to them after cancellation or expiration. * * title: Change Membership Level…Continue reading
/** * Filter the settings of email frequency sent when using the Extra Expiration Warning Emails Add On * https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/ * * Update the $settings array to your list of number of days => ”. * Read the Add On…Continue reading