Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / hide-braintree-billing-address-fields.php
Last active September 19, 2024 13:44 — forked from ipokkel/hide-stripe-billing-address-fields.php
Force remove BrainTree billing fields on checkout and billing
<?php // Do NOT copy this line
function hide_address_on_billing_update_if_braintree() {
global $pmpro_pages, $gateway;
// Bail if necessary
if ( empty( $pmpro_pages ) || ( ! is_page( $pmpro_pages['checkout'] ) && ! is_page( $pmpro_pages['billing'] ) ) ) {
return;
}
// Filter out BrainTree billing fields
if ( ! empty( $gateway ) && 'braintree' === $gateway ) {
@kimwhite
kimwhite / one_time_trial_delay_pmpro_registration_checks.php
Last active September 5, 2024 13:12 — forked from travislima/one_time_trial_delay_pmpro_registration_checks.php
Offer one-time trials using the Subscription Delays Add On - updated for an array of Level IDs
<?php
/**
* This code stores data when a user checks out for a level. Updated for an array of Level IDs
* If that user tries to checkout for the same level, the Subscription Delay is removed.
* The user is instead charged for their first subscription payment at checkout.
*
*/
// Record when users gain the trial level.
function one_time_trial_save_trial_level_used( $level_id, $user_id ) {
@kimwhite
kimwhite / pmpro_mailchimp_merge_fields.php
Last active August 21, 2024 19:14 — forked from dparker1005/pmpro_mailchimp_merge_fields.php
Creates a new merge field in Mailchimp if one doesn't already exist.
<?php
// Add Zip to Mailchimp
// Copy from below here...
/*
* Creates a new merge field in Mailchimp if one doesn't already exist.
*/
function my_pmpro_mailchimp_merge_fields( $merge_fields ) {
// Adds a "COMPANY" merge field to Mailchimp.
//$merge_fields[] = array('name' => 'COMPANY', 'type' => 'text');
@kimwhite
kimwhite / my_pmpro_require_group_code_to_register.php
Last active October 29, 2024 17:39 — forked from dwanjuki/my_pmpro_require_group_code_to_register.php
Require a group code to register for a level
<?php // copy from below
/**
* Set multiple levels to require Group code.
*
* 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/
*/
@kimwhite
kimwhite / sell-courses-addon-packages.php
Last active January 24, 2025 10:27 — forked from andrewlimaza/sell-series-addon-packages.php
Sell PMPro Course as AddOn Packages
<?php
/**
* Adds the AddOn Package post meta to 'Courses' post type.
* Give access if they purchased "Courses" parent container.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_pmpro_courses_to_AP( $types ) {
$types[] = 'courses';
@kimwhite
kimwhite / french-canadian-price-format.php
Last active March 27, 2024 15:22 — forked from ipokkel/french-canadian-price-format.php
Change the display format of a price. This example will change the price format display to a Hungary format.
<?php
/**
* Change the display format of a price for a specific currency.
*
* 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/
*/
@kimwhite
kimwhite / pmpro-billing-fields-optional.php
Last active October 2, 2024 13:35 — forked from andrewlimaza/pmpro-bstate-optional.php
Make some billing fields optional
<?php
/**
* Remove the some billing fields generated by PMPro or Address for Free Levels Add On
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_remove_billing_required( $pmpro_required_billing_fields ){
// Correctly define the array of fields you want to remove
$remove_fields = array( 'baddress1','baddress2', 'bcity','bstate','bcountry','bphone',);
// add bfirstname blastname or bzipcode
@kimwhite
kimwhite / generate-username-from-email-pmpro.php
Last active November 9, 2024 16:06 — forked from andrewlimaza/generate-username-from-email-pmpro.php
Generate a username during checkout for user [Paid Memberships Pro]
<?php
/**
* Make user name email address the same
* Hide your 'username' field using custom CSS.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_generate_username_at_checkout() {
//check for level as well to make sure we're on checkout page
@kimwhite
kimwhite / my_pmpro_remove_change_level_link.php
Created January 31, 2024 18:57 — forked from dparker1005/my_pmpro_remove_change_level_link.php
Removes the 'change' button from the PMPro membership account page
<?php
/**
* This recipe will create a custom field using the Register Helper Add-on, and display the
* respective field on the membership card.
*
* 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/
*/