Skip to content

Instantly share code, notes, and snippets.

View MaryOJob's full-sized avatar
🏠
Working remotely 😈

Mary Job MaryOJob

🏠
Working remotely 😈
View GitHub Profile
<?php //do not copy
/**
* This code snippet checks if there's more than one item in the cart,
* finds the cheapest product and discounts it from the cart's total.
*/
function buyone_getone_free_discount() {
$contents = edd_get_cart_contents();
@ideadude
ideadude / my_pmpro_additional_categories.php
Created October 19, 2022 09:59 — forked from strangerstudios/my_pmpro_additional_categories.php
Add "Purchase Additional Access" box to Membership Checkout for a la carte category purchase.
<?php
/**
* Require specific category user meta to view posts in designated categories.
* Custom price-adjusting fields are added via user fields.
* The initial payment and billing amount is adjusted based on cat selections.
*
* 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/
@kimwhite
kimwhite / pmpro-grace-period.php
Last active April 19, 2023 16:15 — forked from travislima/pmpro-grace-period.php
Add a "Grace Period" to a Paid Memberships Pro Membership (After expiration date is met). by level
<?php
/*
* The Code Recipe will add a 15-day grace period to a members membership once the membership expires.
* for specific levels, change line 13 to your level ID
* Add this Code Recipe to a PMPro Customization Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* For more information on Paid Memberships Pro - www.paidmembershipspro.com
*/
function my_pmpro_membership_post_membership_expiry( $user_id, $level_id ) {
// Make sure we aren't already in a grace period for this level
@MaryOJob
MaryOJob / pmpro-extra-fields.php
Created September 22, 2022 21:45 — forked from ronalfy/pmpro-extra-fields.php
PMPro - Add Extra Fields - Sync with Add User from Admin
<?php
/**
* Modified customer gist. Adds profile fields and saves them.
* Compatible with Add User from Admin 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/
*/
@ipokkel
ipokkel / gettext_checkout_email_in_logged_in_message.php
Created September 16, 2022 09:56
Show user's email address in place of the login name in the "Your are logged in as" message on the PMPro checkout page.
<?php
/**
* Replace user's login displayed to email address in the "You are logged in as"
* on the PMPro checkout 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 / pmpromd-disable-oembed.php
Last active September 18, 2024 16:32
Remove embeds on the PMPro Member Directory pages. #oembed
<?php
/**
* Remove embeds on the PMPro Member Directory 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/
*/
@andrewlimaza
andrewlimaza / send-admin-email-update-user.php
Last active November 5, 2024 15:32
Send admin an email when a user updates their email address in their WordPress profile.
<?php
/**
* Send admin an email when a user's email is updated via their Edit Profile page.
* Full Guide - https://yoohooplugins.com/send-email-to-admins-on-wordpress-profile-update/
* Add this code to your site by following - https://yoohooplugins.com/customize-wordpress/
*/
function yh_send_admin_email_user_updated( $user_id, $old_data, $new_data ) {
// Send an email to an admin when the user's email changes.
if ( $old_data->data->user_email !== $new_data['user_email'] ) {
@ipokkel
ipokkel / email-custom-membership-expiring-template-per-level.php
Last active July 21, 2023 13:42
Custom membership expiring email subject and template per membership level.
<?php
/**
* This recipe sets a custom membership expiring email template and subject line per level.
*
* In this example recipe we created a custom email template for level ID's 1 & 2
* in the "email" folder inside our customization plugin's directory.
*
* Note: This recipe and the required email template folders need to be added
* to a custom plugin and will not work from a third-party plugin that adds
* php customization recipes to the site.
@dparker1005
dparker1005 / next_last_payment_dates_members_list.php
Last active July 14, 2025 08:24 — forked from kimcoleman/next_last_payment_dates_members_list.php
Adds last payment date and next payment date to the members list and export CSV in Paid Memberships Pro (PMPro).
<?php
/**
* Adds last payment date and next payment date to the members list and export CSV.
* Note that "last payment" value will get the last order in "success", "cancelled", or "" status. (Oddly enough, cancelled here means that the membership was cancelled, not the order.)
*
* 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.
*
* 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.