Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created October 6, 2012 18:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save strangerstudios/3845777 to your computer and use it in GitHub Desktop.
Save strangerstudios/3845777 to your computer and use it in GitHub Desktop.
All Access Levels with Paid Memberships Pro and PMPro-Addon-Packages .1.2+
/*
Set levels as "all access levels" so members of these levels will be able to view all Addon Packages.
Requires Paid Memberships Pro and the pmpro-addon-packages plugin.
*/
function my_pmproap_all_access_levels($levels, $user_id, $post_id)
{
//I'm just adding the level, but I could do some calculation based on the user and post id to programatically give access to content
$levels = array(16);
return $levels;
}
add_filter("pmproap_all_access_levels", "my_pmproap_all_access_levels", 10, 3);
@kimwhite
Copy link

kimwhite commented Feb 4, 2021

@laurenhagan0306
Copy link

This recipe is included in the blog post on "Allow Specific Membership Levels to View Addon Packages – and Require Others to Pay" at Paid Memberships Pro here: https://www.paidmembershipspro.com/allow-specific-membership-levels-to-view-addon-packages-and-require-others-to-pay/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment