Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / my_pmpro_member_links.php
Created March 22, 2023 18:27 — forked from kimcoleman/my_pmpro_member_links.php
Example of how to add links to the Member Links list on the Membership Account page.
@kimwhite
kimwhite / pmpro_changeMembershipLevel.php
Last active March 13, 2023 15:26 — forked from femiyb/pmpro_changeMembershipLevel.php
When users cancel (are changed to membership level 0) we give them another "cancelled" level.
<?php
/**
* When users cancel (are changed to membership level 0) we give them another "cancelled" level.
* Can be used to downgrade someone to a free level when they cancel.
* Will allow members to the "cancel level" to cancel from that though.
*/
function pmpro_after_expiration_change_membership_levels( $level_id, $user_id ) {
// set this to the id of the level you want to give members when they cancel
$last_level_tohave = 5;
$level_togive_cancel_id = 6;
@kimwhite
kimwhite / my-pmproio-codes-uses-per-level.php
Last active February 22, 2023 13:14 — forked from ipokkel/my-pmproio-codes-per-level.php
Experimental code to change number of invite codes uses per level.
<?php
/**
* This is an experimental workaround for PMPro Invite Only
* to assign a different number of invite codes depending on
* the level a user checks out for.
*
* This experimental code has not be thoroughly tested and is
* considered as a "use-at-your-own-risk" code snippet that
* is NOT suitable for a live/production environment.
*
@kimwhite
kimwhite / change-email-tet-for-pmpro-approvals.php
Last active February 15, 2023 19:51 — forked from ipokkel/change-email-tet-for-pmpro-approvals.php
Change the account is now pending text string in emails for the PMPro Approvals Add On
<?php
/**
* Change localized text strings for Paid Memberships Pro Approvals Add On
* using the WordPress gettext filter.
*
* 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
/**
* Change the text for PMPro BuddyPress using the gettext filter.
*
* 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-clear-stats.php
Last active September 8, 2023 13:48 — forked from femiyb/clear_stats.php
Clear out all PMPro member and report data.
<?php // do not copy this line
/*
Clear out all PMPro member and report data. (Back up your database first. Use at your own risk!!!)
This will delete all orders, members/level data, and reporting data.
Your levels, discount codes, and settings will remain in place.
All users will remain users (without memberships).
All subscriptions at the gateway will remain active.
To Use:
* Copy this code into your active theme's functions.php or a custom WP plugin.
@kimwhite
kimwhite / reset-pmpro-visits-views-logins.php
Last active January 10, 2023 21:34 — forked from ipokkel/reset-pmpro-visits-views-logins.php
Reset visits, views logins and sales and Revenue for Paid Memberships Pro.
<?php
/**
* Add http://yoursite.com/wp-admin/admin.php?&pmpro_reset_analytics=1 to your url while logged in.
* Add this code to your Code Snippets / Custom Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* You may remove this code from your site when you don't need it any longer.
*/
function my_pmpro_reset_visit_data() {
// Check if URL parameter pmpro_reset_analytics is set
if ( isset( $_REQUEST['pmpro_reset_analytics'] ) ) {
@kimwhite
kimwhite / show-renewal-link-after-X-days-or-less.php
Last active January 3, 2023 15:20 — forked from travislima/show-renewal-link-after-X-days-or-less.php
Change when to show the renewal link on Paid Memberships Pro account page.
@kimwhite
kimwhite / pmpro_after_checkout_gift_level_set_expiration.php
Last active January 2, 2023 19:33 — forked from strangerstudios/pmpro_after_checkout_gift_level_set_expiration.php
Code to get PMPro Gift Levels and PMPro Set Expiration Dates to play together nicely.
<?php
/*
This should allow you to set a calendar end date to work with Gift Memberships.
Use at your own risk.
If a gift level is purchased, copy the set expiration date if applicable.
Must have Gift Membership Add On and with Set Expiration Date being used.
*/
function pmpro_after_checkout_gift_level_set_expiration($user_id)
{
@kimwhite
kimwhite / show-renewal-link-on-30-days-or-less.php
Created December 15, 2022 14:36 — forked from andrewlimaza/show-renewal-link-on-30-days-or-less.php
Change when to show the renewal link on Paid Memberships Pro account page.