This file contains 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
//show a 404 page when trying to access a profile page for members with "Hide from Directory?" checked and/or don't have a specific level | |
function my_pmpromd_profile_preheader() | |
{ | |
// -------- Edit this line to determine which levels get profile pages ---------- // | |
$directory_levels = array(1, 2, 3); | |
global $post, $pmpro_pages, $current_user, $wp_query; | |
if(!empty($post->ID) && $post->ID == $pmpro_pages['profile']) | |
{ | |
//Get the profile user |
This file contains 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 a custom social login shortcode with PMPro Social Login (Requires v.3 or above) | |
function my_pmprosl_custom_shortcode($shortcode) | |
{ | |
// edit this line to change the shortcode displayed on the checkout page | |
return '[TheChamp-Login title="Use your Social Account to Login"]'; | |
} | |
add_filter("pmprosl_login_shortcode", "my_pmprosl_custom_shortcode"); |
This file contains 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
function my_pmprowoo_active_preserve_startdate( $level_id, $user_id ) | |
{ | |
global $wpdb; | |
if( $level_id != 0 && did_action( "woocommerce_subscription_status_active" ) ) | |
{ | |
$startdate = get_user_meta( $user_id, "pmprowoo_startdate_$level_id", true ); | |
if( !empty($startdate) ) | |
{ | |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->pmpro_memberships_users SET startdate = %s WHERE user_id = %d AND status = 'active'", $startdate, $user_id ) ); | |
} |
This file contains 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
// Remove shipping address from PMPro-generated emails when using Shipping Add On | |
function my_pmproship_remove_email_filter() | |
{ | |
remove_filter( "pmpro_email_body", "pmproship_pmpro_email_body", 10, 2 ); | |
} | |
add_action( "init", "my_pmproship_remove_email_filter"); |
This file contains 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
/* | |
Change cancellation to set expiration date for next payment instead of cancelling immediately. | |
Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly). | |
Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs. | |
*** Updated 2018-11-16 to also check for calls from PayFlow Recurring Orders Add On | |
*/ | |
//before cancelling, save the next_payment_timestamp to a global for later use. (Requires PMPro 1.8.5.6 or higher.) | |
function my_pmpro_before_change_membership_level_customization($level_id, $user_id) { | |
global $pmpro_pages, $wpdb, $pmpro_stripe_event, $pmpro_next_payment_timestamp, $cancelling; | |
// Is this being called from the PayFlow Recurring Orders Add On? |
This file contains 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
// don't cancel memberships when woocommerce orders go on hold | |
function my_pmpro_woocommerce_on_hold_keep_membership() | |
{ | |
remove_action( 'woocommerce_subscription_status_on-hold', 'pmprowoo_cancelled_subscription', 10, 1 ); | |
remove_action( 'woocommerce_subscription_status_on-hold_to_active', 'pmprowoo_activated_subscription', 10, 1 ); | |
} | |
add_action('init', 'my_pmpro_woocommerce_on_hold_keep_membership'); |
This file contains 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
// preserve requested redirect with PMPro Member Homepages | |
// forked from @greathmaster | |
function pmpromh_modified_login_redirect($redirect_to, $request, $user) | |
{ | |
if(isset($request) && $redirect_to != admin_url()) | |
return $request; | |
//check level | |
if(!empty($user) && !empty($user->ID) && function_exists('pmpro_getMembershipLevelForUser')) { | |
$level = pmpro_getMembershipLevelForUser($user->ID); |
This file contains 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
.pmpro_checkout-field-bstate { | |
display: none; | |
} |
This file contains 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
/* | |
Add bcc for PMPro admin emails | |
*/ | |
function my_pmpro_email_headers_admin_emails($headers, $email) | |
{ | |
$approval_admin = array( "admin_approved", "admin_denied", "admin_notification" ); | |
//bcc emails already going to admin_email | |
if( strpos($email->template, "_admin") !== false || in_array($email->template, $approval_admin) ) | |
{ |
OlderNewer