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
@dparker1005
dparker1005 / next_last_payment_dates_members_list.php
Last active August 10, 2023 15:38 — 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.
@ipokkel
ipokkel / remove-payment-plans-if-discount-code-applied.php
Created June 20, 2022 09:30
Removes payment plans from a membership level checkout if a discount code is applied.
<?php
/**
* This recipe removes payment plans from the PMPro checkout page if a
* discount code is applied.
*
* 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/
*/
@dparker1005
dparker1005 / my_pmprosm_create_sponsor_code_if_needed.php
Last active May 18, 2023 13:00
When a user logs in, check if they have a sponoring level but don't have a sponsor code. If this is the case, create one.
<?php
// Copy from below here...
/**
* When a user logs in, check if they have a sponoring level but don't have
* a sponsor code. If this is the case, create one.
*
* IMPORTANT: If your sponsored members code is set up setting `seats` instead of
* `max_seats`, this code will need to be udpated accordingly.
<?php // do not copy this line.
/**
* Sponsored Members setup with child seat costs at checkout.
* SPONSOR SEAT + 4 seats 19.95 each
* + 5 to 19 @ 17.95
* + 20 to 39 @ $15.95
* + 40 to 79 @ 14.95
*
* 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.
@ipokkel
ipokkel / restrict-buddypress-activity-page.php
Created May 18, 2022 10:14
Restrict and redirect non-members away from the BuddyPress activity or BuddyBoss news feed page.
<?php
/**
* Restrict and redirect non-members away from the BuddyPress activity page (news-feed).
*
* 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 recipe will display the earnings value of an affiliate via shortcode.
* Add [affiliate_earnings] to a page to display the current users earnings.
*
* The default roles that we're looking for are subscribers. You can change this on line 18
* The number of days a cookie will remain active before expiring is 30 days (Line 49)
*
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@ipokkel
ipokkel / discount-code-field-for-signup-shortcode.php
Last active May 23, 2024 10:09
Add a discount code field to a PMPro Shortcode Signup form.
<?php
/**
* This recipe creates a discount code field for a specific level
* when using the Signup Shortcode for membership registration.
*
* This can be helpful when a level requires a discount code for registration, or
* if the Signup Shortcode level is a paid level and you have a discount code that
* makes this level free.
*
* This recipe assumes the following:
@ipokkel
ipokkel / pmpro-member-directory-change-display-name.php
Created April 25, 2022 14:21
Override the display name for a user in the PMPro Member Directory and Profile pages by changing the display name to user meta, e.g. company name.
<?php
/**
* This recipe changes a user's display name on directory and
* profile pages with custom meta data if the data is available.
*
* This requires the Member Directory and Profile Pages Add On version 1.0 or later.
* https://www.paidmembershipspro.com/add-ons/member-directory/
*
* A use case for this would be to display a company name instead of the user's name(s).
*
@ipokkel
ipokkel / pmpro-member-directory-clickable-usr-url.php
Created April 20, 2022 13:55
Display the user_url field as a clickable URL link on the PMPro Member Directory and Profile pages if the field was included in the shortcode's field attributes.
<?php
/**
* Show a clickable URL for the user_url profile field.
* This will also stop the URL from being embedded with wp_oembed.
*
* 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/
*/