Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
<?php
/**
* Example PMPro HTML User Field.
*
* 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 example_html_pmpro_user_field() {
<?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 ) {
/* Custom styling for the highlight level of the level comparison table */
/* Apply borders to the highlighted column */
.pmpro_advanced_levels-compare_table th.pmpro_level-highlight,
.pmpro_advanced_levels-compare_table td.pmpro_level-highlight {
border-left: 6px solid #00d084;
border-right: 6px solid #00d084;
}
/* Add border to the top of the highlighted column */
/* Highlight the middle column of the level comparison table
Adjust the CSS selectors to match your preferred column to highlight. */
/* Add a border */
.pmpro_advanced_levels-compare_table thead th:nth-child(3),
.pmpro_advanced_levels-compare_table tbody td:nth-child(3),
.pmpro_advanced_levels-compare_table tfoot td:nth-child(3) {
border-left: 6px solid #00d084;
border-right: 6px solid #00d084;
}
<?php
/**
* Customize the no access message for members with pending approvals.
*
* This will only work if PMPro Approvals is active and PMPro version is 3.1 or greater.
*
* 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
/**
* Set the minimum password score for the PMPro Require Strong Passwords Add On.
*
* 1 is somewhat guessable (guesses < 10^8), provides some protection from unthrottled online attacks
* 2 is safely unguessable (guesses < 10^10), offers moderate protection from offline slow-hash scenario
* 3 is very unguessable (guesses >= 10^10) and provides strong protection from offline slow-hash scenario
*
* 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.
<?php
/**
* Prorate the level cost text displayed for level 2.
* Set your proration on line 24
*
* 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 / my-pmpro-shipping-optional-fields.php
Last active August 29, 2024 09:27
Make some Shipping Address fields optional.
<?php
/**
* Make PMPro Shipping Address fields optional.
*
* Fields: 'pmpro_sfirstname', 'pmpro_slastname', 'pmpro_saddress1', 'pmpro_scity', 'pmpro_sstate', 'pmpro_scountry', 'pmpro_szipcode', 'pmpro_sphone'
*
* 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 / my-pmpro-block-active-members-from-checkout.php
Last active August 29, 2024 09:47
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/
*/