This file contains 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 | |
/* | |
Add this code to your theme's functions.php file to update the checkout page to support international credit cards. | |
*/ | |
/* | |
First we need to enable international addresses. We just use the pmpro_international_addresses hook and return true. | |
This will add a "countries" dropdown to the checkout page. | |
*/ | |
function my_pmpro_international_addresses() | |
{ |
This file contains 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
/* | |
Redirect to login or homepage if user is logged out or not a member | |
Add this code to your active theme's functions.php file. | |
*/ | |
function my_template_redirect() | |
{ | |
global $current_user; | |
$okay_pages = array(pmpro_getOption('billing_page_id'), pmpro_getOption('account_page_id'), pmpro_getOption('levels_page_id'), pmpro_getOption('checkout_page_id'), pmpro_getOption('confirmation_page_id')); | |
This file contains 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 | |
/* | |
Adding First and Last Name to Checkout Form | |
*/ | |
//add the fields to the form | |
function my_pmpro_checkout_after_password() | |
{ | |
if(!empty($_REQUEST['firstname'])) | |
$firstname = $_REQUEST['firstname']; |
This file contains 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
/* | |
PMPro Example Offering Monthly and Annual Options on Checkout Page | |
This code assumes your levels have an annual recurring cost. | |
The first function converts your annual prices into monthly prices. | |
*/ | |
function my_getMonthlyPriceFromAnnualPrice($price) | |
{ | |
//divide by 10 and round down to nearest dollar | |
return floor($price / 10); | |
} |
This file contains 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 the membership level dropdown in the admin if the user has a subscription at the gateway. | |
This will keep admins from accidentally cancelling subscriptions. | |
Note: Requires PMPro version 1.3.7+ | |
*/ | |
function my_pmpro_profile_show_membership_level($show, $user) | |
{ | |
global $wpdb; | |
//if the user's membership level is attached to a gateway, disable this field | |
$last_invoice = new MemberOrder(); |
This file contains 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
/* | |
Paid Memberships Pro/WP e-Commerce Integration | |
Description: | |
This group of functions will add a secure sign up link to the confirmation message for a specific product setup with WP E-commerce. | |
The session id from the order is passed to the PMPro checkout form, and will allow registration for a membership level that is otherwise disabled. | |
Once the user registers, the session id is added to the usermeta table as pmpro_sessionid_used so the session id can only be used once. | |
Requirements: | |
The Paid Memberships Pro plugin (v1.3.8 or higher) must be enabled. |
This file contains 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
/* | |
***** | |
UPDATE: This gist is no longer needed. | |
The better way to integrate PMPro and bbPress is to the use the pmpro-bbpress plugin, | |
which is now available in the WordPress repository: | |
http://wordpress.org/plugins/pmpro-bbpress/ | |
***** | |
This file contains 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
/* | |
Functions to give access to certain pages within a timeframe. | |
Set the $pages and $levels arrays. | |
*/ | |
function my_pmpro_has_membership_access_filter($hasaccess, $mypost, $myuser, $post_membership_levels) | |
{ | |
$pages = array(214); // page ids | |
$levels[1] = array("2012-01-01", "2012-04-01"); // $level[level_id] = array(start_date, end_date); | |
$levels[2] = array("2012-02-01", "2012-05-01"); // date format is YYYY-MM-DD |
This file contains 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 Shipping | |
Plugin URI: https://gist.github.com/gists/1894897/ | |
Description: Add shipping to the checkout page and other updates. | |
Version: .2.1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
Note that this plugin requires PMPro 1.3.19 or higher to function fully. |
This file contains 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. |
OlderNewer