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 | |
/** | |
* Limit Post Views: Don't allow post views for certain categories. | |
*/ | |
function my_pmprolpv_has_membership_access( $has_access, $post ) { | |
// Set blocked categories here. | |
$blocked_categories = array( 'silver', 'gold' ); | |
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 | |
/* | |
* PMPro RSS Extra Feeds Example | |
* | |
* Extra feeds format: | |
* $feeds["Label"] = Feed URL | |
* | |
* learn more about feed URLs at http://codex.wordpress.org/WordPress_Feeds | |
*/ |
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 | |
/** | |
* Prevent sponsor members from checking out with their own sponsor code. | |
*/ | |
function my_pmprosm_pmpro_registration_checks( $continue ) { | |
global $current_user, $discount_code, $wpdb; | |
// Is a discount code being used? |
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 | |
/** | |
* Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order. | |
* Add this code recipe to a PMPro Customization Plugin - Display messages of the Original Price, Discounted Price and Amount Saved when discount code is applied to PMPro order | |
* Various classes added to strings to allow for styling - ".pmpro-discorig-message", ".pmpro-orginal-price", ".pmpro-discount-price", ".pmpro-save-price" | |
* | |
* [my_pmpro_applydiscountcode_return_js] Display original price and discount when a discount code is applied. | |
* @param string $discount_code [description] | |
* @param integer $discount_code_id [description] |
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 new custom fields to Advanced Settings with an array of options. Supports 'text','select', and 'textarea' as field_types. | |
// | |
//Example: | |
// | |
function my_advanced_settings() { | |
$custom_fields = array( | |
'field1' => array( | |
'field_name' => 'test1', |
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 | |
/** | |
* Hide Auto-Renewal Checkbox for Check payment | |
*/ | |
function my_pmpropbc_enqueue_scripts() { | |
global $pmpro_pages; | |
if(is_page($pmpro_pages['checkout'])) { |
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
/** | |
* Testing the pmprosed_fixDate function. | |
* 1. Make sure PMPro and PMPro Set Expiration Dates is active. | |
* 2. Add this code to a custom plugin. | |
* 3. Visit ?test_fix_date=1 to a URL | |
* 3a. Add &use_test_date to test from a custom date (set $now below) | |
* 4. Remember to remove the code when done. | |
*/ | |
function test_set_expiration_dates() { | |
if ( empty( $_REQUEST['test_fix_date'] ) ) { |
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 | |
/* | |
* Remember last post ID | |
*/ | |
function my_wp() { | |
global $post, $pmpro_pages; | |
//don't track pmpro pages | |
if( ! in_array($post->ID, $pmpro_pages)) | |
setcookie('last_post_viewed', $post->ID, null, '/'); |
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 | |
/* PMPro Gift Levels Example */ | |
global $pmprogl_gift_levels; | |
$pmprogl_gift_levels = array( | |
// Set level 1 as a "Purchase Gift" membership level to create a gift code for a free level 2 gift. | |
1 => array( // "Purchase Gift" level ID | |
'level_id' => 2, // Membership Level ID of the gift membership 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 | |
/** | |
* Simple Proration for Upgrades Example | |
*/ | |
function my_pmpro_checkout_level( $checkout_level ) { | |
// Get user's current level. | |
$user_level = pmpro_getMembershipLevelForUser(); | |
NewerOlder