Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 20:02 (UTC +03:00)
View GitHub Profile
<?php
/**
* Deferred-payment promo: when a member of the eligible level checks out for
* the level using the promo discount code, push their first recurring payment
* out to 1 year after their existing subscription's next payment date.
* They still pay the initial payment now.
*
* 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.
@dwanjuki
dwanjuki / susbsite-delete-user-remove-memberships.php
Created August 14, 2026 09:51
Remove memberships on main site when user is deleted from a subsite
<?php
/**
* Remove memberships on main site when user is deleted from a subsite.
*
* 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/
*/
@dwanjuki
dwanjuki / my_pmprogl_send_recipient_email_default_checked.php
Created August 11, 2026 16:49
Default "Automatically deliver the gift code by email after checkout" field to checked for Gift Levels.
<?php
/**
* Default "Automatically deliver the gift code by email after checkout" field
* to checked for Gift Levels.
*
* 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/
*/
@dwanjuki
dwanjuki / hide-confirm-email-password.php
Last active August 11, 2026 10:42 — forked from kimcoleman/hide-confirm-email-password.php
Hide the confirm email and confirm password fields from the Paid Memberships Pro checkout page for a specific level.
<?php
/*
* Don't show confirm password or email fields on the checkout page,
* but only for the specified level.
*
* 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/
*/
@dwanjuki
dwanjuki / my_pmpro_skip_expiration_email_during_grace.php
Created August 6, 2026 15:39
Don't Send the Membership Expired Email When a Member Is Given a Grace Period
<?php
/**
* Don't Send the Membership Expired Email When a Member Is Given a Grace Period
*
* Pairs with the "Add a Grace Period to a Membership Level" recipe here:
* https://www.paidmembershipspro.com/add-a-grace-period/
*
* 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.
@dwanjuki
dwanjuki / my-pmpro-bp-member-only-activity.php
Last active August 5, 2026 15:08
BuddyPress/BuddyBoss: Prevent non-members from posting to activity feed or reacting to activity.
<?php
/**
* BuddyPress/BuddyBoss: Prevent non-members from posting, commenting on, or liking activity.
*
* 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
/**
* This recipe adds user fields to the invoice 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/
*/
@dwanjuki
dwanjuki / open_category_posts_to_all_visitors.php
Last active July 22, 2026 09:28
Make posts with specified categories accessible to everyone
<?php
/**
* Posts in specified categories will not require membership to view
*
* 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 my_pmpro_open_category_posts_to_all_visitors( $hasaccess, $thepost, $theuser, $post_membership_levels) {
@dwanjuki
dwanjuki / my_pmpro_downloads_show_in_searches_and_archives.php
Created July 21, 2026 10:29
Keep PMPro downloads visible in searches/archives/library even when "Filter Searches and Archives" is set to Yes.
<?php
/**
* Keep PMPro downloads visible in searches/archives/library
* even when "Filter Searches and Archives" is set to Yes.
*
* The files remain protected.
*
* 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.
@dwanjuki
dwanjuki / adjust-pmpro-subscription-delay.php
Last active July 17, 2026 10:23 — forked from andrewlimaza/adjust-pmpro-subscription-delay.php
Adjust Subscription Delay based on signup date
<?php
/**
* Set the subscription profile_start_date to the 1st of a month.
*
* New signups: roughly one year from checkout, snapped to the 1st.
* Renewals extended by the Auto-Renewal Checkbox Add On: keep the extended
* start date it calculated, snapped to the 1st.
*
* NOTE: This is for yearly membership levels.
*/