Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / my_pmpro_sponsored_members_charge_recievers.php
Last active April 3, 2021 04:01 — forked from MaryOJob/my_pmpro_sponsored_members_charge_recievers.php
Allows sponsored recipients to individually pay for the seats given by their sponsored giver.
<?php
/*
* This codes requires you to have the PMPro Sponsored/Group Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This code recipe is an example that allows membership level 2 to purchase 5 group membership accounts for membership level 3.
* However, level 3 members will need to individualy pay an initial payment of $20 for their membership accounts.
*/
global $pmprosm_sponsored_account_levels;
@travislima
travislima / show_member_number_on_card.php
Last active April 4, 2021 03:26 — forked from andrewlimaza/show_member_number_on_card.php
Display the Unique Member Number on Membership Card Add On Paid Memberships Pro
<?php
/**
* This will show a member number on the membership card for Paid Memberships Pro. Please read all comments below!
* This requires the following - https://www.paidmembershipspro.com/generate-a-unique-member-number-for-display-on-membership-account-confirmation-email-and-more/
* At the time of this writing, created a custom page template and added in hook "do_action( 'pmpro_membership_card_additional_fields', $pmpro_membership_card_user );" to the relevant area.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Reach out to the PMPro Support team for help with this code recipe - https://www.paidmembershipspro.com/support/
*/
@travislima
travislima / pmpro-member-number-csv.php
Last active April 4, 2021 03:26 — forked from greathmaster/pmpro-member-number-csv.php
Show member number in Members List and Members List CSV export.
<?php
/**
* Show member number in Members List and Members List CSV export.
* Useful for offering multiple pricing structures for membership (i.e. Monthly, Annually).
* Requires the PMPro Member Unique Number Code Recipe - https://www.paidmembershipspro.com/generate-a-unique-member-number-for-display-on-membership-account-confirmation-email-and-more/
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_members_list_csv_extra_columns($columns)
@travislima
travislima / bcc-admin-email-for-a-level.php
Created October 1, 2019 08:39 — forked from andrewlimaza/bcc-admin-email-for-a-level.php
BCC email addresses based on membership level.
<?php
/**
* Tweaked from BCC Admin on Member Emails - https://www.paidmembershipspro.com/bcc-additional-email-addresses-on-member-or-admin-notifications/
* Add this code to your PMPro Customizations Plugin.
* Adjust the membership ID to match that of your levels.
*/
function my_pmpro_email_headers( $headers, $email ) {
// Default BCC address to default email address.
@travislima
travislima / my_pmpro_payment_plan_checkout_boxes.php
Last active April 23, 2021 11:35 — forked from dparker1005/my_pmpro_payment_plan_checkout_boxes.php
Define payment plans by mapping a level to discount codes representing payment plan options
<?php
/**
* Create payment plans by mapping a level to discount codes representing payment plan options.
* Useful for offering multiple pricing structures for membership (i.e. Monthly, Annually)
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
global $pmpro_payment_plans;
@travislima
travislima / gist:3a534702aa87ff1f0d31249f18939c02
Created September 10, 2019 18:05 — forked from andrewlimaza/show-member-id-to-account-page.php
Show 'Member ID' on the account page for Paid Memberships Pro
<?php
/**
* This shows the WordPress User ID as a Member ID on the Paid Memberships Pro Account Page.
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* www.paidmembershipspro.com
*/
function pmpro_add_user_id_account() {
global $current_user;
@travislima
travislima / pmprozapier_email_after_change_level.php
Last active April 4, 2021 03:54 — forked from LMNTL/pmprozapier_email_after_change_level.php
Send WP new user email and PMPro admin change email after registering a member through a PMPro Zapier zap
<?php
/**
* Send WP new user email and PMPro admin change email after registering a member through a PMPro Zapier zap
* Requires Paid Memberships Pro and PMPro Zapier add on to be installed and activated - https://www.paidmembershipspro.com/add-ons/pmpro-zapier/
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_zapier_email_after_change_level( $level_id, $user_id ){
if( isset( $_SERVER["REQUEST_URI"] ) && ( strpos( $_SERVER["REQUEST_URI"], "pmpro_zapier_webhook" ) !== false ) ){
@travislima
travislima / next_payment_date_account.php
Created August 20, 2019 11:30 — forked from andrewlimaza/next_payment_date_account.php
Show next payment date under the 'Expiration' field in the PMPro Account Page
<?php
/**
* Show next payment date under 'Expiration' field in PMPro account page.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Works for PayPal Express and Stripe payment gateways.
* www.paidmembershipspro.com
*/
// Change the expiration text to show the next payment date instead of the expiration date
// This hook is setup in the wp_renewal_dates_setup function below
function my_pmpro_expiration_text($expiration_text) {
@travislima
travislima / member-phone-number-pmpro.php
Last active April 4, 2021 03:56 — forked from andrewlimaza/member-phone-number-pmpro.php
Add phone number to checkout for Paid Memberships Pro.
<?php
/**
* Adds a custom phone field to PMPro checkout page.
* Requires the PMPro Register Helper Add On to be installed and activated - https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
@travislima
travislima / exclude-discount-woocommerce-categories.php
Created July 23, 2019 11:31 — forked from andrewlimaza/exclude-discount-woocommerce-categories.php
Exclude membership discount for products in a certain category for WooCommerce and Paid Memberships Pro.
<?php
/**
* This will exclude products that belong to a specific category from the membership discount.
* Add the below code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_exclude_woocommerce_discounts_for_categories( $price, $level_id, $original_price, $product ) {
// Array of categories to exclude, uses category slug.
$exclude_categories = array( 'category-1', 'category-2', 'category-3' );