Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / send-invoice-after-checkout.php
Created October 11, 2018 10:18 — forked from andrewlimaza/send-invoice-after-checkout.php
Send an invoice email after user signs up for a membership - Paid Memberships Pro
<?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 );
}
@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 / pmpro_frontend-oldschool.css
Last active April 12, 2021 22:27 — forked from kimcoleman/pmpro_frontend-oldschool.css
Return the style of labels and form inputs on the Membership Checkout form to pre-1.9.4 layout using Paid Memberships Pro
<style>
@media only screen and (min-width: 1200px) {
#pmpro_form h3 {
display: grid;
grid-template-columns: 2fr 1fr;
}
.pmpro_checkout .pmpro_checkout-fields .pmpro_checkout-field {
clear: left;
}
.pmpro_checkout .pmpro_checkout-fields .pmpro_checkout-field label {
@travislima
travislima / pmpro_registration_checks_no_email_user_login.php
Created January 12, 2018 12:37 — forked from ideadude/pmpro_registration_checks_no_email_user_login.php
Stop users from setting their username to an email address with Paid Memberships Pro
/*
Stop users from setting their username to an email address
Add this code to a custom plugin.
*/
function pmpro_registration_checks_no_email_user_login($continue) {
//if there are earlier problems, don't bother checking
if(!$continue)
return;
//make sure the username passed in doesn't look like an email address (contains a @)
@travislima
travislima / stop-non-pmpro-members-from-buying-woocommerce.php
Last active April 12, 2021 20:23 — forked from andrewlimaza/stop-non-pmpro-members-from-buying-woocommerce.php
Make certain WooCommerce products not-purchasable for non-members
<?php
/**
* Stop non-members from purchasing products if they do not have an active Paid Memberships Pro Level.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function stop_non_pmpro_members_from_buying_woo( $is_purchasable, $product ) {
// Check if the user has an active membership level.
@travislima
travislima / remove_member_homepages_redirect.php
Last active April 12, 2021 20:22 — forked from andrewlimaza/remove-homepage-replacement.php
Remove homepage replacement for admins only (Paid Memberships Pro HomePages Add On)
<?php
/**
* Remove the replacement homepage from the Member HomePages Add On for Paid Memberships Pro.
*
* Add this code (L7-L12 only) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function remove_member_homepages_redirect(){
if ( current_user_can( 'manage_options' ) ) {
remove_action( 'template_redirect', 'pmpromh_template_redirect_homepage' );
}
@travislima
travislima / pmpro-adjust-price-for-members.php
Last active April 12, 2021 20:20 — forked from andrewlimaza/pmpro-adjust-price-for-members.php
Adjust checkout pricing for existing members for Paid Memberships Pro.
<?php
/**
* This will adjust membership pricing depending on users current level and level checking out for. See line 10.
* This will show you how to adjust the initial amount and/or the recurring amount. If the existing level, in this case 2, is not a recurring level please uncomment lines 12-14.
* Add this code (L8 - L20) to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_adjust_price_for_members( $level ) {
// Adjust price for existing members that currently have Membership level id 1 and are upgrading to Membership Level id 2.
@travislima
travislima / add-text-before-submit-button-example.php
Last active April 12, 2021 20:19 — forked from andrewlimaza/add-text-before-submit-button-example.php
Add text before submit button in Paid Memberships Pro
<?php
/**
* Adds text before the submit button on the checkout page.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_text_before_submit() {
echo 'Hello! This will add some <a href="#" target="_blank">information</a> to your site for you.';
}
add_action( 'pmpro_checkout_before_submit_button', 'add_text_before_submit' );
@travislima
travislima / pmpro-select-membership-duration.php
Last active April 8, 2021 22:10 — forked from greathmaster/pmpro-select-membership-duration.php
Allows customers to select membership duration at checkout. Adjusts the amount charged and expiration date of the membership accordingly.
<?php
/**
* Allow customers to select membership duration at checkout. Adjust the amount charged and expiration date of the membership accordingly.
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* Requires the Paid Memberships Pro Register Helper Add On to be installed and activated in order to work:
* https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
*/
@travislima
travislima / pmpro-group-discount-order-csv-export.php
Last active April 8, 2021 20:42 — forked from greathmaster/pmpro-group-discount-order-csv-export.php
Add the group code column to the Order CSV export
<?php //Do not copy this PHP tag into your code.
/**
* Adds an extra colum to your Memberships > Orders > Export to CSV file. Displays the group discount code used.
*
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
* Requires the Paid Memberships Pro Group Discount code Add On to be installed and activated in order to work:
* https://www.paidmembershipspro.com/add-ons/group-discount-codes/
*/