Skip to content

Instantly share code, notes, and snippets.

@michaelbeil
michaelbeil / pmpro-bulgarian-currency.php
Last active August 17, 2022 18:19 — forked from ronalfy/pmpro-bulgarian-currency.php
Paid Memberships Pro - Bulgarian Currency
<?php
// Adds the BGN currency to currency list.
function pmpro_currencies_bulgarian( $currencies ) {
$currencies['BGN'] = __( 'Bulgarian Lev', 'pmpro' );
return $currencies;
}
add_filter( 'pmpro_currencies', 'pmpro_currencies_bulgarian' );
@michaelbeil
michaelbeil / pmpro-columns-grid-payment-method-select-checkout.css
Last active June 20, 2022 22:19 — forked from kimwhite/pmpro-columns-grid-payment-method-select-checkout.css
Custom CSS for Membership Checkout page with Payment Method Select using CSS Grid: 2 Column Layout for "Account Information" and "Billing Information" sections (with conditionals)
<?php // do not copy this line.
/**
* This recipe adds custom CSS for non-logged in users on screens larger then 768px.
*
* 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/
*/
<?php
// Add this code below to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
add_filter( 'gettext', 'change_my_text_example', 20, 3 );
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function change_my_text_example( $translated_text, $text, $domain ) {
@michaelbeil
michaelbeil / function_to_change_pmpro_donation_text.php
Last active April 25, 2023 23:21 — forked from andrewlimaza/function_to_change_pmpro_donation_text.php
Function that changes 'Make a Gift' text - PMPRO Donations Add on
<?php
/*
This function simply edits the text 'Make a Gift' for PMPRO Donations Add-On
Please paste this function in your functions.php or custom plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_donations_change_text( $change_text, $text, $domain ) {
switch ( $change_text ) {
case 'Make a Gift' :
$change_text = __( 'Make A Legislative Contributionn', 'pmpro-donations' ); //edit 'Make A Legislative Contribution' to edit the text output of 'Make a Gift'
@michaelbeil
michaelbeil / change-default-checkout-button-pmpro.php
Last active October 27, 2023 08:23 — forked from andrewlimaza/change-default-checkout-button-pmpro.php
Change default checkout button text for Paid Memberships Pro
<?php
/**
* Change default checkout button
* Simply change the text value to 'Submit' or whatever you like
*
* 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/
*/
@michaelbeil
michaelbeil / pmpro-cancelled-level.php
Last active April 7, 2022 19:31 — forked from pbrocks/pmpro-cancelled-level.php
Move PMPro members to another level when they cancel.
<?php
/**
* By default cancelled members are changed to level 0. This recipe changes that behavior to give them a "cancelled" level that
* you have created for that purpose. Can be used to downgrade someone to a free level if they cancel.
*/
/**
* [pmpro_after_change_membership_level_default_level description]
*
* @param [type] $level_id [description]
* @param [type] $user_id [description]
<?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
@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.
@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.
*
<?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 ) ) {