Skip to content

Instantly share code, notes, and snippets.

Avatar

Jarryd Long JarrydLong

View GitHub Profile
View mypmpro-change-checkout-title-text.php
<?php
function mypmpro_change_membership_checkout_text( $translated_text, $text, $domain ) {
if( isset( $_GET['level'] ) ){
if ( $translated_text === 'Membership Level' ){
global $pmpro_levels;
if( !empty( $pmpro_levels[$_GET['level']] ) ){
@JarrydLong
JarrydLong / hide_discount_code_field_for_specific_levels.php Hide discount code field on the PMPro checkout page for specified levels.
View hide_discount_code_field_for_specific_levels.php
<?php
function hide_discount_code_field_for_specific_levels($show)
{
global $pmpro_level;
if( in_array( intval( $pmpro_level->id ), array(1,2) ) )
{
$show = false;
}
View mypmpro-change-checkout-selected-text.php
<?php
function mypmpro_change_membership_checkout_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'You have selected the <strong>%s</strong> membership level.':
$translated_text = __( 'Thank you for selecting <strong>%s</strong>.', 'pmpro' );
break;
}
View mypmpro-show-renewal-date-members-page.php
<?php
/**
* This recipe will display the renewal date on the Members page. This recipe is intended to be used with Stripe.
* Notes:
* - If a date is returned, we know it's a recurring membership
* - If -- is returned, then that specific order is either cancelled or has been renewed (check for a newer order)
* - If Inactive is returned, we were unable to calculate the next payment date.
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Works for PayPal Express and Stripe payment gateways.
View mypmpro-change-cance-text.php
<?php
//copy lines 5 onwards into your 'PMPro Customizations' plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function pmproc_change_my_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Yes, cancel this membership' :
$translated_text = 'Cancel';
break;
}
View pmpro-invite-only-example.php
<?php //do not copy
//declare as globals
global $pmproio_invite_required_levels;
global $pmproio_invite_given_levels;
$pmproio_invite_required_levels = array(4); //Which levels require an invite code (these levels cannot be signed up for without an invite code)
$pmproio_invite_given_levels = array(5); //Which levels generate an invite code but do NOT require an invite code to be used when purchasing.
define('PMPROIO_CODES', 10 ); //How many invite codes are generated when a $pmproio_invite_given_levels level is purchased?
View mypmpro-show-renewal-date-orders-page.php
<?php //do not copy
/**
* This recipe will display the renewal date on the Orders page. This recipe is intended to be used with Stripe.
* Notes:
* - If a date is returned, we know it's a recurring membership
* - If -- is returned, then that specific order is either cancelled or has been renewed (check for a newer order)
* - If Unknown is returned, we were unable to calculate the next payment date.
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
View mypmpro-geocode-users-only.php
<?php
/**
* This recipe will geocode the members based on their user account only.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
View mypmpromm_custom_billing_on_checkout-specific.php
<?php
/**
* This recipe will geocode the custom billing fields we've created during checkout.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function mypmpromm_checkout_override(){
View mypmpro-change-level-price-based-on-country.php
<?php //do not copy
/**
* This recipe will change the level values based on the country and level selected
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*