Skip to content

Instantly share code, notes, and snippets.

Avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / pmpro_haspaid_shortcode_example.php
Created Jan 31, 2018
An example block using the [haspaid] shortcode for Paid Memberships Pro
View pmpro_haspaid_shortcode_example.php
[haspaid level="1" paid="0"]
<div class="pmpro_message pmpro_default">
<h2>Unlock Additional Members-only Content!</h2>
You are currently on a free trial membership. To unlock additional content, please upgrade now to a full membership.
[pmpro_checkout_button level="1" text="Upgrade to Gold Membership"]
</div>
[/haspaid]
@kimcoleman
kimcoleman / pmpro_haspaid_shortcode_example2.php
Created Jan 31, 2018
Another example block using the [haspaid] shortcode for Paid Memberships Pro
View pmpro_haspaid_shortcode_example2.php
[membership level="1"]
[haspaid level="2" paid="1"]
<div class="pmpro_message pmpro_default">
<h2>Baby come backand save $50</h2>
I see that you used to be a Platinum level member. I wanted to extend a one-time offer for you to upgrade to Platinum today and save $50.
[memberlite_btn style="action" href="/membership-checkout/?level=2&amp;discount_code=50OFF" text="Upgrade to Platinum Membership" icon="heart"]
</div>
[/haspaid]
@kimcoleman
kimcoleman / my_pmprorh_after_email_init_maxk97.php
Created Feb 7, 2018
Register Helper field for a select2 element for Interests for thread by maxk97
View my_pmprorh_after_email_init_maxk97.php
<?php
function my_pmprorh_after_email_init() {
//don't break if Register Helper is not loaded
if( !function_exists( 'pmprorh_add_registration_field') ) {
return false;
}
//define the fields
$fields_after_email = array();
@kimcoleman
kimcoleman / custom_pmproeewe_email_frequency.php
Last active Feb 7, 2018
Filter the settings of email frequency when using the Extra Expiration Warning Emails Add On
View custom_pmproeewe_email_frequency.php
<?php
/**
* Filter the settings of email frequency sent when using the Extra Expiration Warning Emails Add On
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/
*
* Update the $settings array to your list of number of days => ''.
* Read the Add On documentation for additional customization using this filter.
*/
function custom_pmproeewe_email_frequency( $settings = array() ) {
@kimcoleman
kimcoleman / custom_pmproeewe_email_frequency_and_templates.php
Created Feb 7, 2018
Filter the settings of email frequency and custom email template when using the Extra Expiration Warning Emails Add On
View custom_pmproeewe_email_frequency_and_templates.php
<?php
/**
* Filter the settings of email frequency and template sent when using the Extra Expiration Warning Emails Add On
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/
*
* Update the $settings array to your list of number of days => 'template_name'. The example below uses a custom
* email template added to your active theme in a new 'paid-memberships-pro/emails' custom folder.
* The email file name is listed without its .html extension.
*/
@kimcoleman
kimcoleman / my_pmprorh_after_email_init_igbc.php
Created Feb 7, 2018
Register Helper checkbox field for thread by igbc
View my_pmprorh_after_email_init_igbc.php
<?php
function my_pmprorh_after_email_init_igbc() {
//don't break if Register Helper is not loaded
if( !function_exists( 'pmprorh_add_registration_field') ) {
return false;
}
//define the fields
$fields_after_email = array();
@kimcoleman
kimcoleman / pmprodon_pmpro_donation_recurring.php
Last active Feb 8, 2018 — forked from andrewlimaza/pmpro-recurring-donations.php
Adds recurring donation functionality to the Donations Add On for Paid Memberships Pro: https://www.paidmembershipspro.com/add-ons/donations-add-on/
View pmprodon_pmpro_donation_recurring.php
<?php
/*
* This gist adds recurring functionality to the Donations Add On for Paid Memberships Pro.
* It adds the user-entered 'donation amount' to their recurring billing amount.
*/
//add donation amount to recurring payment amount
function pmprodon_pmpro_donation_recurring( $level ) {
if( isset( $_REQUEST['donation'] ) ) {
$donation = preg_replace( '[^0-9\.]', '', $_REQUEST['donation'] );
@kimcoleman
kimcoleman / my_pmprorh_after_email_checkboxes_init.php
Created Feb 8, 2018
Register Helper field for checkbox elements for Interests for thread by maxk97
View my_pmprorh_after_email_checkboxes_init.php
<?php
function my_pmprorh_after_email_checkboxes_init() {
//don't break if Register Helper is not loaded
if( !function_exists( 'pmprorh_add_registration_field') ) {
return false;
}
//define the fields
$fields_after_email = array();
@kimcoleman
kimcoleman / my_pmpro_discount_code_toggle.php
Created Feb 8, 2018
Change the text of the discount code area on membership checkout for almacartney
View my_pmpro_discount_code_toggle.php
<?php
//Change the text of the discount code area on membership checkout
function my_pmpro_discount_code_toggle( $translated_text, $text, $domain ) {
if( $domain == 'paid-memberships-pro' ) {
$translated_text = str_replace( 'Click here to enter your discount code', 'Have a discount code?', $translated_text);
$translated_text = str_replace( 'Do you have a discount code?', '', $translated_text);
}
return $translated_text;
}
add_filter( 'gettext', 'my_pmpro_discount_code_toggle', 10, 3);
@kimcoleman
kimcoleman / add_pmpro_level_id_to_body_class.php
Last active Jul 30, 2020
Add the member's level ID to the <body> tag's "class" attribute.
View add_pmpro_level_id_to_body_class.php
<?php
/**
* Add the member's level ID to the <body> tag's "class" attribute.
*
* 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/
*
*/