This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom Register Helper fields for Irishhealer thread on price-adjusting fields. | |
*/ | |
function irishhealer_adjust_price_pmprorh_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Count the number of times a subscription ID has processed in total with each added order. | |
*/ | |
function count_transation_ids( $MemberOrder ) { | |
global $wpdb; | |
$orders = $wpdb->get_results("SELECT o.*, UNIX_TIMESTAMP(o.timestamp) as timestamp, l.name as membership_level_name FROM $wpdb->pmpro_membership_orders o LEFT JOIN $wpdb->pmpro_membership_levels l ON o.membership_id = l.id WHERE o.user_id = '$MemberOrder->user_id' AND o.subscription_transaction_id = '$MemberOrder->subscription_transaction_id' ORDER BY timestamp DESC"); | |
$orders_count = count( $orders ); | |
} | |
add_action( 'pmpro_added_order', 'count_transation_ids' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove the welcome message from the WooCommerce My Account page. | |
*/ | |
function remove_woocommerce_account_content() { | |
if ( function_exists( 'pmpro_getMembershipLevelForUser' ) ) { | |
$level = pmpro_getMembershipLevelForUser(); | |
if ( esc_attr( $level->ID ) === '4' ) { | |
remove_action( 'woocommerce_account_content', 'woocommerce_account_content' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register Helper custom fields for irishhealer. | |
*/ | |
function irishhealer_pmprorh_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Fire Facebook Pixel on second order | |
*/ | |
function fire_fb_pixel( $MemberOrder ) { | |
global $wpdb; | |
$orders = $wpdb->get_results("SELECT o.*, UNIX_TIMESTAMP(o.timestamp) as timestamp, l.name as membership_level_name FROM $wpdb->pmpro_membership_orders o LEFT JOIN $wpdb->pmpro_membership_levels l ON o.membership_id = l.id WHERE o.user_id = '$MemberOrder->user_id' AND o.subscription_transaction_id = '$MemberOrder->subscription_transaction_id' ORDER BY timestamp DESC"); | |
$transactionCount = count( $orders ); | |
if( $transactionCount == 2 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use this recipe to add the [pmpro_member_profile] to your bbPress user profile page. | |
*/ | |
function insert_pmpro_member_profile_shortcode() { | |
$user_id = bbp_get_user_id( 0, true, false ); | |
echo do_shortcode( '[pmpro_member_profile fields="Company,company; Industry sector,tourism_sector; Region,tourism_region;Country,pmpro_bcountry;Website,user_url" show_bio="true" show_email="true" show_level="false" show_startdate="false" show_avatar="false" user_id="' . $user_id . '"]' ); | |
} | |
add_action( 'bbp_template_before_user_profile', 'insert_pmpro_member_profile_shortcode', 15, 0 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use new pmproap_text_level_id filter to choose the user's currenet level OR a specific level with access. | |
* Update this code as needed and add to a custom plugin. | |
*/ | |
function choose_specific_level_for_addon_packages( $text_level_id, $post_id, $user_id, $post_levels ) { | |
if ( ! pmpro_hasMembershipLevel( $text_level_id, $user_id ) && in_array( 8, $post_levels ) ) { | |
$text_level_id = 8; | |
} | |
return $text_level_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom Fields for various sections of checkout | |
*/ | |
function my_pmpro_rh_custom_fields() { | |
global $current_user; | |
// don't break if Register Helper is not loaded | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ensure Paid Memberships Pro compatibility when using the Elementor Page Builder: | |
* https://wordpress.org/plugins/elementor/ | |
* | |
* Your administrator-level account must have a Membership Level in order to edit all of the pages assigned | |
* under Memberships > Pages. | |
* | |
* You must also set a Custom Field on the Membership Checkout page with the key 'pmpro_default_level' and | |
* value of a level ID in order to properly edit your Membership Checkout page using Elementor. |