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 | |
// Adds the BGN currency to currency list. | |
function pmpro_currencies_bulgarian( $currencies ) { | |
$currencies['BGN'] = __( 'Bulgarian', 'pmpro' ); | |
return $currencies; | |
} | |
add_filter( 'pmpro_currencies', 'pmpro_currencies_bulgarian' ); |
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 | |
function pmpro_multisite_subsite_custom_redirect() { | |
if ( is_main_site() || is_admin() ) { | |
return; | |
} | |
if ( function_exists( 'pmpro_hasMembershipLevel' ) ) { | |
global $current_user; | |
if ( 0 == $current_user->ID || ! pmpro_hasMembershipLevel() ) { | |
wp_redirect( get_site_url( 1, '/membership-account/membership-levels/' ) ); // Assume main site ID is 1. | |
exit; |
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 | |
function pmpro_custom_banned_domains( $continue_registration ) { | |
global $pmpro_msg, $pmpro_msgt; | |
if ( isset ( $_REQUEST['bemail'] ) ) { | |
$bemail = sanitize_email( stripslashes( $_REQUEST['bemail'] ) ); | |
$banned_email_domains = array( | |
'.ru', /* Add more email domains here */ | |
); | |
foreach ( $banned_email_domains as $domain ) { | |
if ( strstr( $bemail, $domain ) ) { |
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 | |
/** | |
* Show pages/posts a level/user has access to. | |
* | |
* @param array $atts Shortcode attributes. | |
* | |
* @return string HTML for the post list. | |
*/ | |
function member_content_list( $atts ) { | |
if ( ! is_user_logged_in() ) { |
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 | |
function my_pmprorh_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
// Define the fields. | |
$fields = array(); | |
$fields[] = new PMProRH_Field( |
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 | |
function pmpro_custom_add_discount_code( $atts ) { | |
if ( function_exists( 'pmprosm_getCodeByUserID' ) && is_user_logged_in() ) { | |
global $current_user; | |
$code_id = pmprosm_getCodeByUserID( $current_user->ID ); // Replace $current_user->ID with sponsoree ID. | |
if ( $code_id ) { | |
$discount_code = pmprosm_getDiscountCodeByCodeID( $code_id ); | |
if ( isset( $discount_code->code ) ) { | |
return $discount_code->code; | |
} |
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 | |
function pmpro_add_discount_code_js() { | |
?> | |
<script> | |
jQuery('body').on('DOMSubtreeModified', '#pmpro_level_cost', function(){ | |
setTimeout( function() { | |
var html = jQuery( '#pmpro_level_cost' ).html(); | |
if ( jQuery( '#pmpro_payment_information_fields' ).is(':visible') == false ) { | |
jQuery( '.pmpro_discount_code_status' ).html( html ); | |
} else { |
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 | |
function pmpro_redirect_account_page_to_login() { | |
if ( ! is_user_logged_in() ) { | |
$pmpro_pages = array(); | |
$pmpro_pages[] = pmpro_getOption( 'account_page_id' ); | |
$pmpro_pages[] = pmpro_getOption( 'billing_page_id' ); | |
$pmpro_pages[] = pmpro_getOption( 'cancel_page_id' ); | |
$pmpro_pages[] = pmpro_getOption( 'invoice_page_id' ); | |
if ( ! isset( $_REQUEST['level'] ) ) { | |
$pmpro_pages[] = pmpro_getOption( 'checkout_page_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 | |
function pmprovat_required_vat_fields_submission( $value ) { | |
global $pmpro_msg, $pmpro_msgt; | |
$vat_number = sanitize_text_field( $_REQUEST['vat_number'] ); | |
if ( empty( $vat_number ) ) { | |
$pmpro_msg = 'VAT is required'; | |
$pmpro_msgt = 'pmpro_error'; | |
} | |
return $value; | |
} |
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 | |
function my_pmpro_hide_discount_code_for_level( $show ) { | |
if ( empty( $_REQUEST['level'] ) ) { | |
return false; | |
} | |
if ( 1 === absint( $_REQUEST['level'] ) || 2 === absint( $_REQUEST['level'] ) ) { // 1,2 is the level ID. | |
return false; | |
} | |
return $show; | |
} |