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 code into a custom plugin. | |
* You could also add a direct call to session_start() in your wp-config.php | |
* or another piece of code that runs early. | |
*/ | |
add_action('plugins_loaded', 'pmpro_start_session'); |
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 | |
/** | |
* Only allow users to use the trial level once. This does not affect pre-existing members that had a level before this code is implemented. | |
* Be sure to change the $trial_levels variable in multiple places. | |
* You may add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
//record when users gain the trial level | |
function my_pmpro_after_change_membership_level($level_id, $user_id) | |
{ | |
//set this to the id of your trial 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 | |
/* | |
Member Numbers | |
* Change the generate_member_number function if your member number needs to be in a certain format. | |
* Member numbers are generated when users are registered or when the membership account page is accessed for the first time. | |
*/ | |
//Generate member_number when a user is registered. | |
function generate_member_number($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 | |
/** | |
* Use the pmprowoo_get_membership_price filter to set prices for variable products. | |
* Update the $membership_prices array. | |
* Each item in that array should have a key equal to the membership level id, | |
* and a value equal to an array of the form array( {variable_product_id} => {member_price} ) | |
* | |
* Add this code into a custom plugin. | |
*/ | |
function my_pmprowoo_get_membership_price( $discount_price, $level_id, $original_price, $product ) { |
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: Paid Memberships Pro - Australia GST | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-australia-gst/ | |
Description: Apply Australia GST to Checkouts with PMPro | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
/* |
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 the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
//we have to put everything in a function called on init, so we are sure Register Helper is loaded | |
function my_pmprorh_init() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists( 'pmprorh_add_registration_field' )) { | |
return false; |
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 create a content filter for all pages and posts to remove access to posts that were published before a member's join date. Only posts or pages which require membership will be hidden. Note that pages and posts that require membership will still be hidden from non-members regardless of the publish date. | |
The params passed are: | |
$hasaccess - (bool) what PMPro thinks about whether the user has access | |
$thepost - (post object) the post being checked, usually the current post | |
$theuser - (user object) the user being checked, usually the current user | |
$post_membership_levels - (array of levels) the levels this post requires (if any) | |
*/ | |
add_filter("pmpro_has_membership_access_filter", "hide_old_posts_from_members", 10, 4); |
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 below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Allows customers to select membership duration at checkout. Adjusts the amount charged and expiration date of the membership accordingly. | |
* 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/ | |
*/ | |
function my_pmprorh_init() { |
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
/* | |
Automatically generate password on checkout page. | |
Note: if you want to remove the entire user area and generate usernames and passwords, simply set the pmpro_skip_account_fields filter to return false. | |
Use the intstructions here (http://www.paidmembershipspro.com/documentation/advanced-techniques/templates/) to add a checkout page template with the password fields removed. | |
Uncheck the "Default WP notification email. (Recommended: Leave unchecked. Members will still get an email confirmation from PMPro after checkout.)" option in the PMPro Emails Settings tab. | |
*/ | |
function my_generate_passwords() |
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
// Change 'Membership' to 'Subscription' for Paid Memberships Pro. | |
function my_gettext_membership( $translated_text, $text, $domain ) { | |
if( "paid-memberships-pro" == $domain ) { | |
$translated_text = str_replace( "Membership Level", "Subscription", $translated_text ); | |
$translated_text = str_replace( "membership level", "subscription", $translated_text ); | |
$translated_text = str_replace( "membership", "subscription", $translated_text ); | |
$translated_text = str_replace( "Membership", "Subscription", $translated_text ); | |
} | |
return $translated_text; | |
} |