Skip to content

Instantly share code, notes, and snippets.

View ipokkel's full-sized avatar

Theuns Coetzee ipokkel

View GitHub Profile
@ipokkel
ipokkel / membership-card.php
Created May 3, 2024 07:35
Example Membership Card template with a custom end date function that returns the furthest end date or next payment date for a user's level(s).
<?php
/**
* Template: Membership_Card
* Version: 1.1.3
*
* Example Membership Card template with a custom end date function
* that returns the furthest end date or next payment date for a user's level(s).
*
* Requires PMPro 3.0 or higher to check next payment date for recurring subscriptions.
*
<?php // do not copy this line.
/**
* This recipe will let you create a unique member and admin email for renewals.
*
* You must add this recipe to your site by creating a custom plugin
* Read this companion article for step-by-step directions
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/*
<?php
/**
* Prevent users from buying a conflicting membership levels in WooCommerce.
*
* 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_pmprowoo_is_purchasable_conflicting_levels( $is_purchasable, $product ) {
<?php
/**
* Make a required user field optional for logged-in users.
*
* 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 make_required_user_field_optional_for_logged_in_users( $field, $where ) {
@ipokkel
ipokkel / pmpro-change-recipient-for-billing-emails.php
Created April 25, 2024 07:05
Change the email recipient for a specified set of email templates if the intended recipient has an alternative recipient email address set as user meta.
<?php
/**
* Change the recipient for billing emails to an additional email address.
*
* 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_recipient_for_billing_emails( $user_email, $email ) {
@ipokkel
ipokkel / pmpro-3-cancel-immediately.php
Created April 18, 2024 09:21
Cancel a membership level immediately instead of setting the expiration date until the next payment date.
<?php
/**
* Cancel an automatically recurring payment membership level immediately
* when a user cancels their membership 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/
*/
<?php
/**
* Add a gateway column to the member edit orders page.
*
* 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 / show-pmpro-shipping-address-fields-on-member-edit.php
Created April 12, 2024 07:31
Show and edit the Shipping Address fields on the Member Edit page for PMPro 3.0 and newer.
<?php
/**
* Show PMPro shipping address fields on the member edit page.
*
* 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 show_pmpro_shipping_address_fields_on_member_edit() {
@ipokkel
ipokkel / add-html-attributes-to-pmpro-user-fields.php
Created April 8, 2024 08:44
Add html attributes to a custom PMPro user field created in settings.
<?php
/**
* Add HTML attributes to PMPro user fields.
*
* 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_html_attributes_to_pmpro_user_fields( $field, $where) {