Skip to content

Instantly share code, notes, and snippets.

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/5774136 to your computer and use it in GitHub Desktop.
Save strangerstudios/5774136 to your computer and use it in GitHub Desktop.
Have a Paid Memberships Pro level with access to EVERYTHING.
/*
Give level 1 members access to everything.
Add this to your active theme's functions.php or a custom plugin.
*/
function my_pmpro_has_membership_access_filter($access, $post, $user)
{
if(!empty($user->membership_level) && $user->membership_level->ID == 1)
return true; //level 1 ALWAYS has access
return $access;
}
add_filter("pmpro_has_membership_access_filter", "my_pmpro_has_membership_access_filter", 10, 3);
@HypnoPro
Copy link

I greatly appreciate you posting this code but when I add it as-is to my theme's function.php nothing happens. I have already set up membership levels 1,2 and 3 so I changed the number to 4. Also, I don't know what else I need to customize to make it work on my site. Can you provide more specifics? Thanks

@premb4
Copy link

premb4 commented Jul 26, 2016

Want to know if this is working now??

@wealthyone
Copy link

This has always worked.
Jason wrote

This gist doesn’t create the level. You would create a level, and then use that leverls ID in the code (ID 1 in the gist above) and it tells PMPro to give that users with that membership level access to everything no matter what the other access rules are.

Typically, you would create a new level for this outside the ones you are selling and swap the 1 in the code with the ID of the level you made.

Hope this helps.

@ryantinker
Copy link

I'm having trouble getting this to work. It seems that this filter isn't being run when my users arrive at a page.

Has "pmpro_has_membership_access_filter" changed to something else?

@laurenhagan0306
Copy link

This recipe is included in the blog post on "How To Have a Paid Memberships Pro level with access to EVERYTHING." at Paid Memberships Pro here: https://www.paidmembershipspro.com/how-to-have-a-paid-memberships-pro-level-with-access-to-everything/

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