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-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
@davidmutero
davidmutero / pmpro-changing-membership-wording-level.php
Created May 5, 2025 12:33
Change the words like 'Membership' to 'Subscription' by Level in Checkout Emails in Paid Memberships Pro
<?php
/**
* Dynamically replace instances of "Membership" with custom labels
* based on the user's membership level. Variables like !!first_name!!
* are preserved and skipped during replacements.
*
* 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-move-user-field-group-after-billing.php
Last active May 2, 2025 08:55 — forked from dparker1005/my_pmpro_move_billing_fields.php
Move a User Field Group Below the Billing Address on PMPro Checkout
<?php
/**
* Move a specific user field group (e.g. Company Info) below the Billing Address on PMPro Checkout.
*
* This uses JavaScript to reposition any fieldset by targeting its ID.
* Update the `$fieldset_id` value to match the fieldset you want to move.
*
* 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/