Skip to content

Instantly share code, notes, and snippets.

Avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / pmpro_rh_step3.php
Last active Mar 16, 2022
Step 3 - Register Helper: A step-by-step guide on creating custom fields.
View pmpro_rh_step3.php
<?php //Do not copy this tag.
/**
* Add custom fields to Paid Memberships Pro checkout page.
* Must have PMPro & Register Helper Add On installed and activated to work.
* Add this code to a PMPro Customizations Plugin or Code Snippets plugin.
*/
function pmpro_add_fields_to_checkout(){
//don't break if Register Helper is not loaded
@travislima
travislima / my_pmpro_login_redirect_url.php
Last active Mar 15, 2022 — 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)
View my_pmpro_login_redirect_url.php
<?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 / load-custom-css-level-pmpro.php
Last active Feb 1, 2022 — forked from andrewlimaza/load-custom-css-level-pmpro.php
Load custom CSS for Membership Checkout for specific level - Paid Memberships Pro
View load-custom-css-level-pmpro.php
<?php
/**
* Load custom CSS on checkoutpage for specific membership level in Paid Memberships Pro.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function load_css_for_level_checkout(){
global $pmpro_pages;
// Change your membership level ID here.
@travislima
travislima / pmpro_change_pay_by_check.php
Last active Jan 22, 2022
Change "Pay by Check" to "Pay by Cheque or Bank Transfer"
View pmpro_change_pay_by_check.php
<?php
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
* A simple gist that changes "Pay by Check" to "Pay by Cheque or Bank Transfer:".
* Copy the code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Pay by Check' :
@travislima
travislima / pmpro-renew-membership-shortcode.php
Last active Dec 22, 2021 — forked from andrewlimaza/pmpro-renew-membership-shortcode.php
Paid Memberships Pro Renew Membership Shortcode
View pmpro-renew-membership-shortcode.php
<?php
/**
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* The my_pmpro_renew_membership_shortcode is a custom function creating a renew link for members.
* Use the shortcode [pmpro_renew_button] to display the button anywhere on your site where shortcodes are recognized.
*
* @return string A link containing the URL string to renew.
*/
@travislima
travislima / automatically-approve-previously-approved.php
Last active Dec 3, 2021 — forked from andrewlimaza/automatically-approve-previously-approved.php
Automatically approve, previously approved members. [Paid Memberships Pro]
View automatically-approve-previously-approved.php
<?php
/**
* Automatically approve any previously approved member.
* Requires the PMPro Approval Process for Membership Add On - https://www.paidmembershipspro.com/add-ons/approval-process-membership/
* Add this code to your site following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_automatically_approve_previously_approved( $level_id, $user_id, $cancelled_level ) {
if ( ! class_exists( 'PMPro_Approvals' ) ) {
@travislima
travislima / pmpro-customizations.php
Last active Aug 19, 2021
PMPro-extra-expiration-warning-emails (Change day email is sent out)
View pmpro-customizations.php
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@travislima
travislima / stop-renewing-members.php
Created Feb 26, 2019 — forked from andrewlimaza/stop-renewing-members.php
Stop members from renewing their current membership level [Paid Memberships Pro].
View stop-renewing-members.php
<?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 ) {
@travislima
travislima / exclude-discount-woocommerce-categories.php
Created Jul 23, 2019 — forked from andrewlimaza/exclude-discount-woocommerce-categories.php
Exclude membership discount for products in a certain category for WooCommerce and Paid Memberships Pro.
View exclude-discount-woocommerce-categories.php
<?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 / send-invoice-after-checkout.php
Created Oct 11, 2018 — forked from andrewlimaza/send-invoice-after-checkout.php
Send an invoice email after user signs up for a membership - Paid Memberships Pro
View send-invoice-after-checkout.php
<?php
/**
* Send the Paid Memberships Pro invoice email on initial checkout for members.
* Add this code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_after_checkout_send_invoice_email( $user_id, $order ) {
$email = new PMProEmail();
$email->sendInvoiceEmail( $user_id, $order );
}