Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / pmpro-tag-delete-inactive-users.php
Last active October 31, 2023 12:06 — forked from ideadude/tag_and_delete_inactive_users.php
Script to tag and delete inactive PMPro Members and users from WordPress.
<?php
/**
* Script to locate, tag, export, then delete inactive users in your Paid Memberships Pro / WordPress website.
*
* Once this snippet is in the site, admins can run the process by visiting /?delete_inactive_users=1 in the WordPress admin.
* Always back up user data before running any bulk delete script and remove this code after the process is done.
*/
function my_pmpro_tag_inactive_users() {
if ( ! defined( 'PMPRO_VERSION' ) ) {
exit;
@kimcoleman
kimcoleman / add-credit-card-image-to-checkout.php
Last active October 12, 2023 20:10 — forked from andrewlimaza/add-credit-card-image-to-checkout.php
Display credit card logos before the submit button on the Paid Memberships Pro Membership Checkout page.
<?php
/**
* Display credit card logos before the submit button on the Paid Memberships Pro Membership Checkout page.
*
* Download the icons from https://www.paidmembershipspro.com/add-credit-card-and-paypal-logos-to-checkout/
* Place the image file in the correct location according to your customizations structure.
*/
function pmpro_add_my_logos_to_checkout(){
global $pmpro_level;
@kimcoleman
kimcoleman / pmpro_expiration_date_shortcode_bbpress_profile.php
Last active February 21, 2022 11:39 — forked from strangerstudios/pmpro_expiration_date_shortcode_bbpress_profile.php
Show a member's expiration date on bbPress profile page.
<?php
/**
* Use this recipe in conjunction with PMPro bbPress Add On to show the expiration date on single forum user profile.
*
* 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.
*
*/
function my_bbp_template_before_user_profile_pmpro_expiration_date() {
$user_id = bbp_get_user_id( 0, true, false );
@kimcoleman
kimcoleman / my_pmpro_set_application_fee_percentage.php
Created August 12, 2021 21:13 — forked from dparker1005/my_pmpro_set_application_fee_percentage.php
Modify the application fee percentage that is charged on Stripe transactions.
<?php
/**
* Modify the application fee percentage that is charged on Stripe transactions.
*
* 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/
*/
@kimcoleman
kimcoleman / dynamic_pmpro_levels_array.php
Created May 12, 2021 20:37 — forked from ipokkel/dynamic_pmpro_levels_array.php
Dynamically display certain levels on the Membership Levels page based on the current user's active level
<?php
/**
* Dynamically display certain levels on the Membership Levels page based on the current user's active level
* This example allows you to show/hide specific levels on the Membership Levels page.
*/
/**
* Dynamically display certain levels on the Membership Levels page based on the current user's active level
* This example allows you to show/hide specific levels on the Membership Levels page.
*/
function dynamic_pmpro_levels_array( $levels ) {
@kimcoleman
kimcoleman / hide-confirm-email-password.php
Last active October 19, 2022 18:25 — forked from strangerstudios/gist:4027538
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page.
<?php
/*
* Don't show confirm password or email fields on the checkout page.
*
* 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/
*/
add_filter( 'pmpro_checkout_confirm_password', '__return_false' );
@kimcoleman
kimcoleman / my_pmpro_change_level_edd_update_payment_status.php
Last active March 13, 2021 19:20 — forked from andrewlimaza/change-level-edd.php
Change user's membership level when a product is purchased in Easy Digital Downloads.
<?php
/**
* This recipe will allow you to assign a membership level to members when purchasing an EDD product.
* You can do this one of two ways:
*
* OPTION 1: Product ID and Membership Level
* $product_levels = array(
27 => 1, //27 is the EDD product ID. 1 is the membership level they get when purchasing product 27
);
*
@kimcoleman
kimcoleman / show_gravatar_pmpro_account_bullets_top.php
Created February 11, 2021 01:19 — forked from strangerstudios/my_pmpro_account_bullets_avatars.php
Display a member's gravatar and a link to update at Gravatar on the Membership Account page "Profile" section.
<?php
/*
* Show a link to Gravatar and an avatar preview on the Profile section of the Membership Account page.
*
* 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/
*/
function show_gravatar_pmpro_account_bullets_top() {
@kimcoleman
kimcoleman / my_pmpro_mailchimp_listsubscribe_fields.php
Last active February 10, 2021 22:08 — forked from strangerstudios/my_pmpro_mailchimp_listsubscribe_fields.php
Example of using the pmpro_mailchimp_listsubscribe_fields filter to send extra fields to Mailchimp. The fields must be created in Mailchimp first, or you must used the pmpro_mailchimp_merge_fields filter to create them.
<?php
/**
* Sync additional user fields to Mailchimp.
* You must create the fields in Mailchimp first.
* Or, you can use the `pmpro_mailchimp_merge_fields` filter to create them through the API.
*
* 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/
@kimcoleman
kimcoleman / next_last_payment_dates_members_list.php
Last active July 5, 2022 14:59 — forked from strangerstudios/nextlastpayments.php
Adds last payment date and next payment date to the members list and export CSV in Paid Memberships Pro (PMPro).
<?php
/**
* Adds last payment date and next payment date to the members list and export CSV.
* Note that "last payment" value will get the last order in "success", "cancelled", or "" status. (Oddly enough, cancelled here means that the membership was cancelled, not the order.)
*
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
*
* 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.