Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@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' );
@travislima
travislima / hide_post_thumbnail_on_restricted_content.php
Last active April 7, 2021 03:33 — forked from kimcoleman/hide_post_thumbnail_on_restricted_content.php
Do not return the post thumbnail (featured image) on restricted content when viewed by a non-member.
<?php
/**
* Do not return the post thumbnail (featured image) on restricted content when viewed by a non-member.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
*
*/
function hide_post_thumbnail_on_restricted_content( $html, $post_id, $post_image_id ) {
if ( function_exists( 'pmpro_has_membership_access' ) ) {
@travislima
travislima / my_pmpro_login_redirect_url.php
Last active March 15, 2022 03:30 — forked from messica/my_pmpro_login_redirect_url.php
Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
<?php
/*
* Redirect on login if user has any failed payments. (Requires Paid Memberships Pro Failed Payment Limit Add On)
* Adjust the code on the line the line "site_url( ' payment-failed')" to redirect to page of your prefereance.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_login_redirect_url( $url, $request, $user ) {
@travislima
travislima / stop-renewing-members.php
Created February 26, 2019 08:20 — forked from andrewlimaza/stop-renewing-members.php
Stop members from renewing their current membership level [Paid Memberships Pro].
<?php
/**
* Stop members from renewing their current membership level.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function stop_members_from_renewing( $okay ) {
// If something else isn't okay, stop from running this code further.
if ( ! $okay ) {