Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
strangerstudios / pmpro_currencies_ruble.php
Last active August 21, 2025 12:59
Add Russian Ruble to PMPro currencies.
function pmpro_currencies_ruble($currencies)
{
$currencies['RUB'] = __('Russian Ruble (RUB)', 'pmpro');
return $currencies;
}
add_filter('pmpro_currencies', 'pmpro_currencies_ruble');
@strangerstudios
strangerstudios / my_pmpro_email_data.php
Created January 23, 2014 20:00
Add a !!todaysdate!! variable for use in Paid Memberships Pro email templates. Add this to your active theme's functions.php or a custom plugin and then include !!todaysdate!! in your email templates.
/*
Adds !!todaysdate!! as an available variable for use in Paid Memberships Pro emails.
Notice the array key does not include the !!s
*/
function my_pmpro_email_data($data, $email)
{
$data['todaysdate'] = date(get_option("date_format"));
return $data;
@strangerstudios
strangerstudios / pmpro_send_expiration_warning_email.php
Created August 4, 2017 14:29
Disable the PMPro Expiration Warning Emails
add_filter('pmpro_send_expiration_warning_email', '__return_false');
@strangerstudios
strangerstudios / wp_head_hide_billing_fields.php
Created September 8, 2014 19:48
Hide Paid Memberships Pro billing address fields and make them optional. Meant to be used with the Braintree gateway.
/*
Hide billing address fields and make them optional.
Meant to be used with the Braintree Payments gateway.
*/
//css to hide the fields
function wp_head_hide_billing_fields()
{
global $post, $pmpro_pages;
if(empty($pmpro_pages) || (!is_page($pmpro_pages['checkout']) && !is_page($pmpro_pages['billing'])))
return;
@strangerstudios
strangerstudios / pmpro-fields.php
Created August 31, 2014 23:22
Custom Fields for PMPro (Church Site)
<?php
/*
Plugin Name: PMPro Fields
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-fields/
Description: Register Helper Initialization Example
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@strangerstudios
strangerstudios / my_pmpro_checkout_level_extend_memberships.php
Last active February 21, 2025 16:56
By default PMPro will only "extend" a membership level if you checkout for the same level. This code will make it so PMPro extends any expiring level with any new expiring level. E.g. if you change from a annual plan to a monthly plan it will add 30 days to the end of your existing membership.
<?php
/*
If checking out for ANY level with an expiration, add remaining days to the enddate.
Pulled in from: https://gist.github.com/3678054
*/
function my_pmpro_checkout_level_extend_memberships($level)
{
global $pmpro_msg, $pmpro_msgt, $current_user;
//does this level expire? are they an existing members with an expiration date?
@strangerstudios
strangerstudios / my_init_pmpro_payment_options.php
Created November 22, 2014 19:23
Get PMPro Pay By Check and PMPro Add PayPal Express to work together.
/*
Get PMPro Pay By Check and PMPro Add PayPal Express to work together.
*/
//remove the checkout_boxes code from both plugins
function my_init_pmpro_payment_options()
{
remove_action("pmpro_checkout_boxes", "pmpropbc_checkout_boxes");
remove_action("pmpro_checkout_boxes", "pmproappe_pmpro_checkout_boxes", 20);
add_action("pmpro_checkout_boxes", "my_pmpro_checkout_boxes_payment_options");
@strangerstudios
strangerstudios / my_pmpro_paypal_button_image.php
Last active February 10, 2025 16:36
Using the pmpro_paypal_button_image filter to change the PayPal button image on the PMPro checkout page.
/*
Add this code to your active theme's functions.php or a custom plugin
to change the PayPal button image on the PMPro checkout page.
*/
function my_pmpro_paypal_button_image($url)
{
return "https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png";
}
add_filter('pmpro_paypal_button_image', 'my_pmpro_paypal_button_image');
@strangerstudios
strangerstudios / my_pmpro_confirmation_url.php
Created April 8, 2016 14:47
Example of using the pmpro_confirmation_url filter to change the PMPro confirmation page for new users.
function my_pmpro_confirmation_url($url, $user_id, $level) {
$already_member = get_user_meta($user_id, 'already_member', true);
if(!$already_member) {
update_user_meta($user_id, 'already_member', 1);
$url = home_url('/my-dashboard');
}
return $url;
}
add_filter('pmpro_confirmation_url', 'my_pmpro_confirmation_url');
@strangerstudios
strangerstudios / gist:5573829
Last active January 10, 2025 12:48
Paid Memberships Pro customization to only let members of a certain level checkout if a discount code was used.
/*
Only let level 1 members sign up if they use a discount code.
Place this code in your active theme's functions.php or a custom plugin.
*/
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration)
{
//only bother if things are okay so far
if(!$pmpro_continue_registration)
return $pmpro_continue_registration;