Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 08:42 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_pmpro_inline_restricted_pdfs.php
Created August 28, 2026 10:18
Display restricted PDFs inline in the browser
<?php
/**
* Display restricted PDFs inline in the browser for members with access.
*
* Restrict files: https://www.paidmembershipspro.com/locking-down-protecting-files-with-pmpro/
*
* 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 / pmpro_ajax_timeout.php
Last active August 20, 2026 10:50 — forked from strangerstudios/pmpro_ajax_timeout.php
Tell PMPro to wait 15 seconds instead of 5 on AJAX calls
<?php
/**
* Change the PMPro AJAX timeout limit.
*
* 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
/**
* 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/
*/
@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.