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
<?php | |
/* | |
Restrict members from accessing members-only content using a checkbox in the profile. | |
The button will only show when logged in as an admin. | |
Requires PMPro and Register Helper Add On to be installed, activated, and configured. | |
*/ | |
function my_pmprorh_init_restrict() | |
{ | |
//don't break if Register Helper is not loaded |
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) ) | |
{ |
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
<?php | |
/* Checks to see if a registration is happening after a given date; if so, prevent registration and stop new signups for the level/no longer display the level on the levels page | |
*/ | |
global $pmproml_end_date, $pmproml_limited_level_id; | |
$pmproml_limited_level_id = 1; // change to the ID of the limited-time membership level | |
$pmproml_end_date = "2019/04/30"; // change to the date registration ends, in YYYY/MM/DD format | |
function pmproml_pmpro_registration_date_checks( $value ) { | |
global $wpdb, $pmproml_end_date, $pmproml_limited_level_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
<?php | |
/* Generate checkout email when using Add Member from Admin Add On for Paid Memberships Pro | |
*/ | |
function pmpro_send_member_notification( $user ) { | |
$pmproemail = new PMProEmail(); | |
$pmproemail->sendCheckoutEmail( $user ); | |
} | |
add_action( 'pmpro_add_member_added', 'pmpro_send_member_notification', 10, 2 ) |
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
// Custom proration for levels with a subcription delay until a specified date (like "Y1-08-01"). | |
// Prorates initial payment based on days until end of subscription delay for level 1 | |
function my_pmprosd_prorate_delay( $level ) | |
{ | |
// change this to the ID of the membership level to prorate | |
if( $level->id == 1 ){ | |
// change this to the day of year the subscription delay ends, in MM-DD format | |
$subscription_day = "08-01"; |
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
// always show renew links for certain levels if the member already has that level. | |
function my_pmpro_always_show_renew_levels( $show, $level ){ | |
/*--- change this line to the levels you want to show a renew link---*/ | |
$show_levels = array( 1, 2 ); | |
if( in_array( $level->id, $show_levels ) ) { | |
$show = true; | |
} |
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 the text for the confirmation link in the PMPro Email Confirmation Add On welcome email | |
function my_pmproec_change_confirmation_text($body) | |
{ | |
//change this line to modify the confirmation text | |
$new_confirmation_text = "Click this link to activate your membership:"; | |
$old_confirmation_text = "IMPORTANT! You must follow this link to confirm your email address before your membership is fully activated:"; | |
$body = str_replace( $old_confirmation_text, $new_confirmation_text, $body ); | |
return $body; |
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_gettext_pmpro_hide_view_membership_options($translated_text, $text, $domain) | |
{ | |
if($domain == "paid-memberships-pro" && $text == "View all Membership Options" ) | |
$translated_text = ""; | |
return $translated_text; | |
} | |
add_filter('gettext', 'my_gettext_pmpro_hide_view_membership_options', 10, 3); |
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 WP User Avatar from Register Helper field during checkout. | |
*/ | |
function my_updated_user_meta($meta_id, $user_id, $meta_key, $meta_value) { | |
// Change user_avatar to your Register Helper file upload name. | |
if( 'user_avatar' == $meta_key) { | |
$filename = $meta_value['fullpath']; | |
$filetype = wp_check_filetype( basename( $filename ), null ); | |
$wp_upload_dir = wp_upload_dir(); | |
$attachment = array( |
NewerOlder