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
/**
* Example of extending a user field to add a depends
*
* This recipe assumes a checkbox field with the name my_checkbox was created.
* This recipe assumes a textarea field with the name my_textarea was created.
*
* 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-user-fields-default-value.php
Last active June 6, 2024 16:16
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.
<?php
/**
* This recipe creates Member Numbers with a prefix that may be customized per level ID.
*
* Change the generate_member_number function if your member number needs to be in a certain format.
* Member numbers are generated when users are registered or when the membership account page
* is accessed for the first time.
*
* Set your default member number prefix in the $member_number_prefix variable.
*
@ipokkel
ipokkel / pmpro-disable-invoice-email-per-level.php
Created November 18, 2022 14:46
Disable PMPro Invoice emails per level.
<?php
/**
* Disable the PMPro invoice email for specified levels.
*
* 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 / pmpro-bcc-invoice-emails.php
Last active May 1, 2023 20:11
Send a copy of invoice email to an additional email address if the member has set an addtional email address.
<?php
/**
* Send a copy of an Invoice email i a member has specified and additional invoice email addresses.
*
* This recipe require an additional email address to be set in usermeta table.
*
* Collecting an additional invoice email address should be achievable with a custom User Field.
* @link https://www.paidmembershipspro.com/documentation/user-fields/
*
* You can add this recipe to your site by creating a custom plugin
@MaryOJob
MaryOJob / member_days_left_pmpro.php
Created November 15, 2022 20:04 — forked from andrewlimaza/member_days_left_pmpro.php
Show "Days Left" for Paid Memberships Pro
<?php
//Copy lines 5 onwards into your PMPro Customizations plugin -> https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
/**
* Add days left to members list
*/
function my_pmpro_days_left_members_list_col_header( $theusers )
{
?>
@MaryOJob
MaryOJob / pmpro-change-level-recurring.php
Created November 15, 2022 20:04 — forked from ronalfy/pmpro-change-level-recurring.php
PMPro - Change Never Label Message for Recurring Levels
<?php
/**
* Changes the output label to Recurring in member/order lists for recurring levels.
*
* 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
/**
* 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