Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • There was a mistake in what I posted above. The bottom part of the code should be as follows ($can_access after the if block).

    
            // Don't allow access to the premium taxonomies unless the user has
            // a premium subscription
            if (! in_array($PREMIUM_SUBSCRIPTION_LEVEL_ID, $level_ids) ) {
                foreach ($PREMIUM_SUBSCRIPTION_TAXONOMY_IDS as $id) {
                    if ($restrictions->content_taxonomy_matches($id)) {
                        return false;
                    }
                }            
            }
            return $can_access;
    

    I encountered the same issue. Here’s a workaround I came up with in the meantime:

    
        add_filter('leaky_paywall_current_user_can_access', function($can_access) {
            if (!$can_access) {
                return false;
            }
            // *** Replace these with the real values for your site ***
            $PREMIUM_SUBSCRIPTION_LEVEL_ID = 1;
            $PREMIUM_SUBSCRIPTION_TAXONOMY_IDS = [5, 6];
    
            $settings = get_leaky_paywall_settings();
            $restrictions = new Leaky_Paywall_Restrictions();
            $level_ids = leaky_paywall_subscriber_current_level_ids();
    
            // Don't allow access to the premium taxonomies unless the user has
            // a premium subscription
            if (! in_array($PREMIUM_SUBSCRIPTION_LEVEL_ID, $level_ids) ) {
                foreach ($PREMIUM_SUBSCRIPTION_TAXONOMY_IDS as $id) {
                    if ($restrictions->content_taxonomy_matches($id)) {
                        return false;
                    }
                }            
                return $can_access;
            }
        });
    

    This issue can be caused by extraneous whitespace at the end of wp-config.php. It’s best to just not have the closing ?> tag at the end of wp-config.php at all (or any PHP file for that matter).

    See my answer to my own question here for more info: https://stackoverflow.com/questions/25754346/add-media-button-not-working-after-upgrade-to-wordpress-3-9

Viewing 3 replies - 1 through 3 (of 3 total)