Skip to content

Instantly share code, notes, and snippets.

@michaelbeil
michaelbeil / custom_pmpro_upcoming_recurring_payment_reminder.php
Last active June 23, 2021 08:57 — forked from kimcoleman/custom_pmpro_upcoming_recurring_payment_reminder.php
Filter to modify the days prior to renewal that the Recurring Payment Email Reminders Add On sends members the membership_recurring email notifcation.
<?php
/**
* Filter to modify the days prior to renewal that the Recurring Payment Email Reminders Add On
* sends members the membership_recurring email notifcation.
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function custom_pmpro_upcoming_recurring_payment_reminder( $rec_array ) {
$rec_array = array ( 30 => 'membership_recurring', 14 => 'membership_recurring', 7 => ' membership_recurring' );
return $rec_array;
@michaelbeil
michaelbeil / member_count-shortcode.php
Created January 4, 2021 09:37
PMPro Member Count Shortcode
<?php
/*
Plugin Name: PMPro Member Count Shortcode
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Show the number of members in a level w/a status
Version: .1
Author: Stranger Studios
Author URI: https://www.strangerstudios.com
*/
function pmpro_member_count_shortcode( $attrs = null )
@michaelbeil
michaelbeil / update_currency_per_level.php
Created June 2, 2021 10:54 — forked from strangerstudios/update_currency_per_level.php
Change currencies depending on Paid Memberships Pro level. Add this code to your active theme's functions.php or a custom plugin. This is just an example that will need to be tweaked for your needs.
/*
Change currencies depending on Paid Memberships Pro level.
Add this code to your active theme's functions.php or a custom plugin.
This is just an example that will need to be tweaked for your needs.
Other places to look into swapping currencies:
* Levels page.
* Invoices page.
* In emails.
* In membership levels table in admin.
@michaelbeil
michaelbeil / my_pmpro_payment_method.css
Last active June 8, 2021 09:59 — forked from kimcoleman/legacy_my_pmpro_payment_method.css
Adds credit card logos to the "Select Payment Method" box on membership checkout.
/* CSS Document */
#pmpro_payment_method span {
display: inline-block;
}
#pmpro_payment_method span a {
background-position: bottom left;
background-repeat: no-repeat;
background-size: contain;
border: none;
display: inline-block;
@michaelbeil
michaelbeil / redirect-users-after-logout-wordpress.php
Last active November 10, 2021 14:45 — forked from andrewlimaza/redirect-users-after-logout-wordpress.php
Redirect users to home page after logging out of WordPress
<?php
/**
* Redirect users to home page after logging out of WordPress.
*/
function my_redirect_after_logout_wp(){
wp_redirect( home_url() );
exit;
}
add_action('wp_logout','my_redirect_after_logout_wp');
@michaelbeil
michaelbeil / my-pmpro-strong-passwords.php
Last active March 7, 2022 18:16 — forked from ipokkel/my-pmpro-strong-passwords.php
Change the required password length to 8 for Require Strong Passwords
<?php // Do NOT copy this line
/**
* Change pmpro-strong-passwords to require a minimum of 8 characters.
*/
add_filter( 'pmpro_registration_checks', 'my_pmpro_strong_password_check' );
function my_pmpro_strong_password_check( $pmpro_continue_registration ) {
// Don't load this script at all if user is logged in.
if ( is_user_logged_in() ) {
<?php
// Define the groups of levels. array(2,3) means that levels 2 and 3 are in a group and options will be shown for both levels at checkout for those levels.
global $pmpro_level_groups;
$pmpro_level_groups = array( array( 2,3 ) );
// Show the "Select a Payment Plan" box with options at checkout.
function pmpro_level_groups_pmpro_checkout_boxes() {
global $pmpro_level_groups, $pmpro_level, $discount_code, $wpdb;
// No groups found? return.
if ( empty( $pmpro_level_groups) || empty( $pmpro_level ) ) {
@michaelbeil
michaelbeil / my_pmpro_cancel_levels_one_by_one
Last active January 12, 2022 20:19 — forked from ideadude/my_pmpro_cancel_levels_one_by_one
When cancelling "all levels" in PMPro, do them one at a time so CONPD works.
<?php
/**
* This gist updates the "cancel all memberships" link on the cancel page
* to pass the level ids into the page instead of "all".
* This will ensure that all the levels are cancelled one by one.
* In addition to sending a separate email for each cancellation,
* this also ensures the $old_level parameter is sent to the
* pmpro_cancelMembershipLevel() function so Add Ons like the
* Cancel on Next Payment Date one continue to work.
*
@michaelbeil
michaelbeil / change-advanced-levels-shortcode.php
Last active January 14, 2022 22:07 — forked from ipokkel/change-advanced-levels-shortcode.php
Change or translate text for PMPro Advanced Levels Shortcode using gettext filter #pmpro-advanced-levels-shortcode #translate
<?php
/**
* This recipe is an example of how to change or translate
* localized text strings for PMPro Advanced Levels Shortcode.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*
* 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.
<?php //do not copy
/**
* This recipe lock members into their existing membership.
* They won't be able to cancel or sign up for a different membership level.
*
* Change lines 21 and 45 to the level ID that requires you to be locked in.
*
* If you don't want to prevent them from cancelling, comment out line 30 with //
*
* You can add this recipe to your site by creating a custom plugin