Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / pmpro_haspaid_shortcode_example.php
Created January 31, 2018 01:11
An example block using the [haspaid] shortcode for Paid Memberships Pro
[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 January 31, 2018 01:13
Another example block using the [haspaid] shortcode for Paid Memberships Pro
[membership level="1"]
[haspaid level="2" paid="1"]
<div class="pmpro_message pmpro_default">
<h2>Baby come back—and 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 February 7, 2018 14:10
Register Helper field for a select2 element for Interests for thread by maxk97
<?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 March 27, 2023 19:31
Filter the settings of email frequency when using the Extra Expiration Warning Emails Add On
<?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
Last active December 13, 2021 19:40
Filter the settings of email frequency and custom email template when using the Extra Expiration Warning Emails Add On
<?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 February 7, 2018 19:43
Register Helper checkbox field for thread by igbc
<?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 January 22, 2022 12:03 — 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/
<?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 February 8, 2018 17:57
Register Helper field for checkbox elements for Interests for thread by maxk97
<?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 February 8, 2018 18:26
Change the text of the discount code area on membership checkout for almacartney
<?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 April 12, 2021 20:28
Add the member's level ID to the <body> tag's "class" attribute.
<?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/
*
*/