Skip to content

Instantly share code, notes, and snippets.

View davidmutero's full-sized avatar

David Mutero davidmutero

View GitHub Profile
@davidmutero
davidmutero / my-pmpro-hide-cancel-button-for-expiring-memberships.php
Created May 19, 2026 13:13
Hide the Cancel Membership Link for Expiring Memberships
<?php
/**
* Remove the Cancel membership action link for memberships
* that already have an expiration date.
*
* Members whose level has an enddate will not see the
* Cancel link on the Membership Account page.
*
* You can add this recipe to your PMPro Customizations Plugin
* or use the Code Snippets plugin.
@davidmutero
davidmutero / my-pmpro-member-directory-az-filter.php
Created May 19, 2026 11:17
Add an A–Z Filter to the PMPro Member Directory
<?php
/**
* Add an A–Z filter navigation to the PMPro Member Directory.
*
* This recipe:
* - Adds A–Z filter links above the directory
* - Filters directory results by the first letter of display_name
* - Includes an "All" reset filter
* - Redirects back to the full directory if no results are found
*
@davidmutero
davidmutero / my-pmpro-restrict-email-address-for-discount-code-by-level.php
Created February 13, 2026 02:41
Restrict Email Adress When Using a Specific Discount Code at Checkout By Level
<?php
/**
* Require a .edu email address when using a specific discount code at checkout.
*
* This recipe checks for a discount code applied via URL or checkout,
* and blocks checkout if the billing email address does not end in .edu.
*
* You can optionally restrict this rule to specific membership levels
* and/or specific discount codes.
*
@davidmutero
davidmutero / my-pmpro-members-list-csv-member-notes.php
Created January 30, 2026 08:49
Add Member Notes to the PMPro Members List CSV Export
<?php
/**
* Add Member Notes (user_notes) to the PMPro Members List CSV export.
*
* This recipe adds a new "Member Notes" column to the CSV
* and populates it from the user meta key `user_notes`.
*
* 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.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@davidmutero
davidmutero / my_pmpro_member_sql_search_where.php
Last active January 27, 2026 13:43 — forked from dwanjuki/my_pmpro_member_sql_search_where.php
Limit Member Directory search to display_name only
<?php
/**
* Limit Member Directory search to display_name only.
*
* 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/
*/
@davidmutero
davidmutero / hide-course-overview-from-nonmembers.php
Last active December 5, 2025 13:51
Hide Course Overview from Non-Members Using the Default Courses Add On Module
<?php
/**
* Hide course overview from non-members
* when using the Default Courses Add On for Paid Memberships Pro.
*
* This prevents non-members from viewing detailed course content blocks
* such as Lesson Overview, Course Description, Requirements, etc.
*
* Add this recipe to your PMPro Customizations Plugin or use the
* Code Snippets plugin.
@davidmutero
davidmutero / my-pmpro-validate-state-field.php
Created October 2, 2025 10:16
Validate 2-Letter State Field at PMPro Checkout
<?php
/**
* Validate that the State field (bstate) contains only 2 letters.
* Also adds helper text below the input field at checkout.
*
* 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.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@davidmutero
davidmutero / bulk-update-users-expiration-one-year-from-start-pmpro.php
Last active July 16, 2025 08:11 — forked from kimwhite/bulk-update-users-expiration-date-pmpro.php
Function to Bulk update user's expiration dates via SQL (One Year from Start Date) - Paid Memberships Pro
<?php. // TESTING
/**
* Run SQL to bulk update all users in a specific membership level.
* Sets enddate = startdate + 1 year.
*
* 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.
*
* IMPORTANT: Have a backup of your site before running this code.
*/
@davidmutero
davidmutero / pmpro-remove-cancel-link-from-account-page-per-level-and-for-payment-plan.php
Last active June 18, 2025 12:05 — forked from ipokkel/pmpro-remove-cancel-link-from-account-page-per-level.php
Remove “Cancel” Link from Account Page Per Level and Specific Payment Plan
@davidmutero
davidmutero / reorder-email-password-checkout-fields.php
Last active May 13, 2025 13:25 — forked from ipokkel/reorder-names-email-password-checkout-fields.php
Reorder PMPro checkout fields to Email and Password. #pmpro #paid-memberships-pro #checkout
<?php
/**
* This recipe moves the checkout fields to appear in the order of
* 1. Email
* 2. Password.
*
* Email fields will be moved (always) to before password fields
* on the checkout page.
*
* You can add this recipe to your site by creating a custom plugin