If shortcodes were used (assuming they didn’t run their own sub WP_Query’s – per that 5 year old WP bug) then MemberPress would be able to protect those by default. So I agree, OP must be using template tags to output ACF content.
If I understand this correctly, ACF can only be used by modifying the theme templates? If that’s the case, then I think using our PHP conditionals would be the only way to make this work (unless you added some kind of global output filter for all fields).
MemberPress has a number of PHP conditionals which can be used in templates.
This first conditional requires a Rule to be set in MemberPress for the current WP_Post (page, post, or custom post type).
<?php if(current_user_can('mepr_auth')) //A Rule exists in MP for the current $post {
// acf content output here
}
The second conditional does not require a Rule to be setup at all, and instead checks if the user has purchased any of the listed Membership levels (by their ID)
<?php if(current_user_can('mepr-active', 'memberships: 123, 321')) //123, 321 etc are ID's of Memberships {
// acf content output here
}
And if the user didn’t want to go through the effort of adding any PHP conditionals, then the redirect on unauthorized setting would be the final option.
@ukguy no problem. @hube2 – I would be interested in looking at some options here so we can hide the AFC content (all AFC content on any MP protected page).
Can you get me some specifics on how you output the AFC content, and if there’s any global filter (similar to the_content) which we could use to hide all AFC output until a member is authorized?
@ukguy – While we look at our options here, you can setup a redirect instead here in your MemberPress Options: http://cspf.co/fW5D/Image%202016-03-24%20at%204.06.59%20PM.png
That will redirect the user away from the page they should not have access to and instead take them to your unauthorized page.
I haven’t had a chance to use AFC yet, so I’m honestly not sure how it works to output its content at this point (shortcodes, theme hacks, appending to the_content)?
MemberPress can both redirect or replace content. It depends on your Unauthorized Access Options and how they’re setup.
Does AFC do any sub wp-queries for its output?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.