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 | |
/* | |
Renewal/Extension Code for PMPro | |
If the user checking out currently has the same level he is checking out for, the initial payment is zeroed out and the subscription is setup to start on the date of the user's next payment. | |
Note this only works for monthly and annual subscriptions now. The my_getNextPaymentDate function would have to be updated to correctly calculate for subscriptions with periods > 1 (e.g. every 3 months), or daily or weekly subscriptions. | |
*/ | |
//if checking out for the same level, waive the initial payment | |
function my_pmpro_checkout_level($level) | |
{ |
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 | |
/* | |
Some WordPress HTTPS Fixes | |
In general, if you are using Paid Memberships Pro, you do not want to use the WordPress HTTPS plugin. PMPro will also secure your links. | |
If you are still receiving SSL errors on your checkout page, try setting the "nuclear" option on the Payment Gateway and SSL settings page of PMPro (v 1.3.19+) | |
If you want to continue using WordPress HTTPS for some reason, add this code to your theme's functions.php or somewhere else to force Paid Memberships Pro | |
to follow WordPress HTTPS' rules for redirecting, etc. | |
*/ | |
//if WordPress HTTPS is activated allow their force_ssl custom field to replace the besecure one | |
function pmpro_WordPressHTTPSForceSSL($besecure) |
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
/* | |
Requires PMPro v1.4+ | |
Code to delete WP user accounts when a member cancels their PMPro account. | |
Users are not deleted if: | |
(1) They are not cancelling their membership (i.e. $level_id != 0) | |
(2) They are an admin. | |
(3) The level change was initiated from the WP Admin Dashboard | |
(e.g. when an admin changes a user's level via the edit user's page) | |
*/ | |
function my_pmpro_after_change_membership_level($level_id, $user_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
function my_jigoshop_sale_price($price, $product) | |
{ | |
if(pmpro_hasMembershipLevel()) | |
{ | |
//no sale price yet? | |
if(empty($price)) | |
$price = $product->get_price(); | |
$price = intval(($price * 0.90)*100)/100; | |
} |
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 | |
/* | |
Limiting posts per user. | |
Enable the Paid Memberships Pro plugin and then add this code to your functions.php or as a stand alone plugin. | |
Be sure to read through this code carefully. Update each function to suit your needs. | |
This code has not been tested. Feel free to post issues in the comments. | |
*/ | |
//increment post limit when checking out | |
function my_pmpro_after_checkout($user_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 | |
/* | |
In Paid Memberships Pro v1.4+ the memberhsip level description is shown on the checkout page. This code will remove the description on the checkout page. | |
*/ | |
function my_pmpro_remove_description_from_checkout_page($level) | |
{ | |
$level->description = ""; | |
return $level; | |
} | |
add_filter("pmpro_checkout_level", "my_pmpro_remove_description_from_checkout_page"); |
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
/* | |
This code will redirect users from the default PMPro confirmation page to a specific page depending on their level. | |
Set the confirmation_pages array. Array keys should be membership level ids and the values are the page ids. So array(1=>2) will redirect membership level with id = 1 to the page with id = 2. | |
*/ | |
function my_pmpro_confirmation_redirect() | |
{ | |
$confirmation_pages = array(1 => 2); //change this use your membership level ids and page ids | |
global $pmpro_pages; | |
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
/* | |
Add this into a custom plugin or your active theme's functions.php | |
*/ | |
add_filter("pmpro_besecure", "__return_true"); |
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
/** | |
* Get the "domain" from a URL. By domain, we mean the host name, minus any subdomains. So just the domain and TLD. | |
* | |
* @param string $url The URL to parse. (generally pass site_url() in WP) | |
* @return string The domain. | |
*/ | |
function getDomainFromURL($url = NULL) | |
{ | |
$domainparts = parse_url($url); | |
$domainparts = explode(".", $domainparts['host']); |
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 Per-level Teasers | |
Plugin URI: http://www.paidmembershipspro.com/pmpro-per-level-teasers/ | |
Description: Change the text shown when member content is filtered based on the membership level required to view that content. | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ |