Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 04:40 (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 ) {
@dwanjuki
dwanjuki / my_pmpro_non_recurring_level_remove_cancel_link.php
Last active October 7, 2024 11:03
Hide Cancel link on account page for levels with an expiration date
@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 { }
@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.
@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/
*/
<?php //do not copy
/**
* Gets the next payment date and marks that as the expiration date for users.
*
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
*
* Remove the // on line 40 to run the update query.
*
* You can add this recipe to your site by creating a custom plugin
@andrewlimaza
andrewlimaza / keep-pmpro-member-price-manual-renewal.php
Created November 4, 2021 10:33
Keep pre-existing members on their initial checkout price when renewing their membership level.
<?php
/**
* Keep pre-existing members on their initial checkout price when manually renewing. Grandfather 'old' members when their levels pricing changes.
* Note: This is not needed for recurring membership levels and is designed for levels with an expiration date.
*
* 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
/* Sample Register Helper fields
Register Helper Add On (https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/)
Add this to your customization plugin for PMPro Customizations: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
or