Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 18:03 (UTC +03:00)
View GitHub Profile
<?php
/**
* Extend the expiration date from a set date for the Set Expiration Date Add On.
*
* 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_pmprosed_extend_expiration_date_from_set_date( $set_date ) {
@ipokkel
ipokkel / my-pmpro-block-active-members-from-checkout.php
Last active July 29, 2025 09:28
Stop users with an active membership from checking out for a membership.
<?php
/**
* Block active members from checking out but allow renewal if membership is expiring soon.
*
* 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
/**
* Redirect away from the cancel page if the user is not cancelling a recurring 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/
*/
function my_redirect_away_from_cancel_if_not_recurring() {
@kimcoleman
kimcoleman / blank_base.css
Last active September 4, 2024 12:10
Sample file for theme developers include the CSS classes for v3.1 of Paid Memberships Pro elements.
.pmpro_message { }
.pmpro_message.pmpro_success { }
.pmpro_message.pmpro_error { }
.pmpro_message.pmpro_alert { }
.pmpro_message a { }
.pmpro_success a { }
.pmpro_error a { }
.pmpro_alert a { }
@dwanjuki
dwanjuki / my_pmpro_run_gettext_on_specific_level_checkout_pages.php
Last active July 9, 2026 13:38
Change/Tranlate text strings for some level checkout pages
<?php
/**
* Change/Tranlate text strings for some level checkout pages
*
* 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/
*/
@ideadude
ideadude / my_pmpro_user_field_swap_to_checkbox_grouped.php
Created December 28, 2023 18:34
Swap a PMPro user field to the checkbox_grouped type.
<?php
/**
* Currently, the PMPro user fields GUI does not allow you to choose
* the checkbox_grouped field type.
*
* These fields can be added via custom code though. If you want to manage some
* aspects of the field in the GUI, you can create a multiselect field,
* then swap it to the checkbox group using this code.
*
* You can add this recipe to your site by creating a custom plugin
@JarrydLong
JarrydLong / pmpro-user-fields-default-value.php
Last active December 19, 2024 09:29 — forked from ipokkel/pmpro-user-fields-default-value.php
Set default field values for PMPro User Fields.
<?php
/**
* Set default values for PMPro user fields.
*
* Supported field types: text, textarea, checkbox, radio, select, select2, multiselect, number, and date.
* Can support readonly and hidden fields, however, they will not be editable by the user.
*
* 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.
@kimcoleman
kimcoleman / pmpro-tag-delete-inactive-users.php
Last active October 24, 2025 10:35 — 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;
@ipokkel
ipokkel / pmpro-prevent-checkout-for-current-levels.php
Created April 10, 2023 11:04
Prevent users from checking out for a level they already have, unless the level is expiring soon and the user can renew.
<?php
/**
* Prevent users from checking out for a level they already have,
* unless the level is expiring soon and the user can renew.
*
* 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/
*/
@ipokkel
ipokkel / pmpro-user-fields-html-attributes-placeholder.php
Created December 14, 2022 09:27
Set a placeholder for PMPro text, textarea, and number User Fields.
<?php
/**
* Set placeholder values for PMPro user fields.
*
* Supported field types: text, textarea, number.
*
* 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/