Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / my-pmpro-show-renew-link-when-level-expires-in-x-days.php
Created December 19, 2024 10:01
Show renewal link X days before expiration by hooking into pmpro_member_action_links. This is an alternative method to the one used in this guide: https://www.paidmembershipspro.com/schedule-renew-link-display/
<?php
/**
* A simple example to show you how to change an error message for checkout on Paid Memberships Pro.
*
* 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 pmpro_change_error_message( $translated_text, $text, $domain ) {
@ipokkel
ipokkel / my-pmpro-change-user-fields-to-level-only.php
Created December 13, 2024 09:59
Set specific user fields to only show for some levels. This can be used to make individual fields level specific if the fields were created via settings in a field group that displays for all levels.
<?php
/**
* Change user fields to level only.
*
* 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_change_user_fields_to_level_only( $field, $where ) {
<?php
/**
* Add a "Total Memberships" column to the Members List and Users List.
*
* 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/
*/
// Add 'Total Memberships' Column to Members columns.
<?php
/**
* Add membership officer to email data
*
* 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_email_data_membership_officer( $data, $email ) {
<?php
/**
* Move the donations "Make a Gift" field on checkout.
*
* 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
/**
* Add a reply-to address to PMPro email headers.
*
* 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 add_reply_to_pmpro_email_headers( $headers, $email ) {
<?php
/**
* Remove countries from the countries list.
*
* For country codes you may refer to the countries.php file.
* @link https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/countries.php
*
* 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.
<?php
/**
* Add donation email vairable and reset membership cost value to exclude donation.
*
* 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_email_data_membership_cost_donation( $data, $email ) {
@ipokkel
ipokkel / make-billing-fields-optional.php
Last active November 28, 2024 16:01
Allow users to make the billing fields optional for the PMPro checkout page when they check a checkbox.
<?php
/**
* Make billing fields optional at checkout
*
* 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/
*/