Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / generate_member_number.php
Last active December 5, 2022 19:22 — forked from strangerstudios/generate_member_number.php
Code to generate incremental Member Number values for PMPro users/members.
<?php // do not copy this line.
/**
* This recipe creates Member Numbers
* Change the generate_member_number function if your member number needs to be in a certain format.
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time.
*
* 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.
@kimwhite
kimwhite / my-pmpro-change-seat-to-student.php
Last active January 13, 2022 19:36 — forked from femiyb/my-pmpro-change-seat-to-student.php
Change the word "Seat(s)" to "student(s)" for Paid Memberships Pro Sponsored Members Add On.
<?php // do not copy this line.
/**
* This will change all instances of seat(s) to student(s) for the Sponsored Members Add On
* https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
*
* 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 / my_pmpro_canadian_tax.php
Last active May 11, 2022 20:33 — forked from dparker1005/my_pmpro_canadian_tax.php
Apply Canadian taxes to Checkouts with PMPro - DEFAULT CHECKED
<?php
/*
* Plugin Name: Paid Memberships Pro - Canadian Tax
* Description: Apply Canadian taxes to Checkouts with PMPro
* Version: .1
* Author: Stranger Studios
* Author URI: http://www.strangerstudios.com
*/
/*
@kimwhite
kimwhite / bulk-update-users-expiration-date-pmpro.php
Last active January 6, 2022 15:00 — forked from andrewlimaza/bulk-update-users-expiration-date-pmpro.sql
Function to Bulk update user's expiration dates via SQL - Paid Memberships Pro
<?php. // TESTING
/**
* Added SQL to a function. Run once then disable.
*
* Bulk update all users to have an expiration date that belong to a specific membership level.
* Visit https://yoursite.com/wp-admin/?my_query=1 when logged in as an admin to have existing users updated.
* Remove this code when finished.
*
* Please update the wp_ prefix to match that of your database as well as the membership_id and enddate value (YYYY-MM-DD).
*
@kimwhite
kimwhite / my_pmprowoo_checkout_level.php
Last active January 4, 2022 14:17 — forked from strangerstudios/my_pmprowoo_checkout_level.php
Get PMPro WooCommerce to work with PMPro Set Expiration Dates
<?php // do not copy this line.
/**
* Get PMPro WooCommerce to work with PMPro Set Expiration Dates
* Mostly assumes annually expiring levels. Use at your own risk.
*
* 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-renew-membership-shortcode.php
Last active December 22, 2021 20:23 — forked from travislima/pmpro-renew-membership-shortcode.php
Paid Memberships Pro Renew Membership Shortcode - with options to show within so many days of renewal
<?php
/**
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* The my_pmpro_renew_membership_shortcode is a custom function creating a renew link for members.
* Use the shortcode [pmpro_renew_button] to display the button anywhere on your site where shortcodes are recognized.
*
* @return string A link containing the URL string to renew.
*/
@kimwhite
kimwhite / my_pmpro_has_membership_access_filter.php
Last active December 20, 2021 21:15 — forked from strangerstudios/my_pmpro_has_membership_access_filter.php
Have a Paid Memberships Pro level with access to EVERYTHING for multiple levels
<?php
/*
Give level 1 members access to everything.
Add this to your active theme's functions.php or a custom plugin.
*/
function my_pmpro_has_membership_access_filter($access, $post, $user)
{
if(!empty($user->membership_level) && in_array( $user->membership_level->ID, array( 12, 14 ) ) )
@kimwhite
kimwhite / my_pmpro_email_headers_bcc.php
Created December 13, 2021 22:23 — forked from femiyb/my_pmpro_email_headers_bcc.php
BCC a second email address on PMPro admin emails.
/*
Add bcc for PMPro admin emails.
Change [email protected],[email protected] below to the addresses you want to use.
Add this code to your active theme's functions.php or a custom plugin
a la http://www.paidmembershipspro.com/2012/08/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_headers_bcc($headers, $email)
{
//bcc emails going to admins
if(strpos($email->template, "admin") !== false)
@kimwhite
kimwhite / my_pmpro_ipn_check_receiver_email.php
Created December 8, 2021 16:05 — forked from strangerstudios/my_pmpro_ipn_check_receiver_email.php
Allow other receiver/business email addresses for PMPro IPN Messages.
function my_pmpro_ipn_check_receiver_email($check, $email)
{
if($email == '[email protected]' || in_array('[email protected]', $email)) //change email here to the old email
$check = true;
return $check;
}
add_filter('pmpro_ipn_check_receiver_email', 'my_pmpro_ipn_check_receiver_email', 10, 2);
@kimwhite
kimwhite / my-pmpro-account-example.php
Last active December 6, 2021 14:13 — forked from andrewlimaza/my-pmpro-account-example.php
Custom shortcode for account page
<?php
/**
* Copy the function below into your custom plugin / Code Snippets plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Replace [pmpro_account] with [my_pmpro_account]
* This example replaces "Change Password" link to point to site's password-reset URL.
*/
/*
my custom Shortcode to show membership account information
*/