This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Buy | |
*/ | |
/* | |
To make a checkout template for your site and PMPro. | |
1. Create a template page based on your page.php, single,php, index.php, etc. | |
2. Find the area where the post_content usually goes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PMPro Hidden Levels | |
Plugin URI: http://www.paidmembershipspro.com/pmpro-hidden-levels/ | |
Description: With this plugin, select levels are removed from the levels page but still available for checkout if you visit the checkout URL directly. | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Important note! This code is included in PMPro versions 1.5.7 and later. | |
Adding this code will add 2x the number of days to the end of the subscription. | |
*/ | |
//if checking out for the same level, add remaining days to the enddate | |
function my_pmpro_checkout_level($level) | |
{ | |
global $pmpro_msg, $pmpro_msgt; | |
//does this level expire? are they an existing user of this level? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Cancel subscriptions when a recurring payment fails. As of PMPro version 1.5.9.1, failed payments reported via Stripe webhook, PayPal IPN handler, or Authorize.net silent post kick off the pmpro_subscription_payment_failed action. | |
Also make sure to edit the default billing_failure.html email to mention that users are cancelled upon failure. To do so, copy paid-memberships-pro/email/billing_failure.html into themes/{active theme}/paid-memberships-pro/email/ and edit the text to suit your need. | |
Note: This cancels on the first failure. To cancel only when cancelling at Stripe, see this gist: https://gist.github.com/strangerstudios/5093710 | |
*/ | |
function my_pmpro_subscription_payment_failed($order) | |
{ | |
//cancel the membership |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Add birthday to user signup and check that user is between 13-17. | |
Will not work with PayPal Standard or PayPal Express. | |
*/ | |
//birthday fields | |
function my_pmpro_checkout_after_email() | |
{ | |
$current_day = date("j"); | |
$current_month = date("M"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Change currencies depending on Paid Memberships Pro level. | |
Add this code to your active theme's functions.php or a custom plugin. | |
This is just an example that will need to be tweaked for your needs. | |
Other places to look into swapping currencies: | |
* Levels page. | |
* Invoices page. | |
* In emails. | |
* In membership levels table in admin. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Disable PMPro Checkout Confirmation Emails | |
Add this code to your active theme's fucntions.php | |
or a custom plugin. | |
*/ | |
function my_pmpro_email_recipient($recipient, $email) | |
{ | |
if(strpos($email->template, "checkout_") !== false) | |
$recipient = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_pmpro_checkout_level_renewal_pricing($level) | |
{ | |
$discount = 25; //change this | |
if(pmpro_hasMembershipLevel($level->id)) //might want to check for specific levels here | |
$level->initial_payment = max(0, $level->initial_payment - $discount); | |
return $level; | |
} | |
add_filter('pmpro_checkout_level', 'my_pmpro_checkout_level_renewal_pricing'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sync PMPro fields to BuddyPress profile fields. | |
*/ | |
function pmprobuddy_update_user_meta($meta_id, $object_id, $meta_key, $meta_value) | |
{ | |
//make sure buddypress is loaded | |
do_action('bp_init'); | |
//array of user meta to mirror | |
$um = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(is_user_logged_in()) | |
$required = false; | |
else | |
$required = true; | |
$fields[] = new PMProRH_Field( | |
"company", // input name, will also be used as meta key | |
"text", // type of field | |
array( | |
"size"=>40, // input size |
OlderNewer