Home Forums Front-end Issues Memberpress support


Memberpress support

  • Hi there,
    We have just installed Memberpress members plugin on a clients website. With basic password protected pages we can use <?php if ( ! post_password_required() ) {?> to ensure the ACF content does not show.
    However, with memberpress this does not work, the content still shows even though a rule says it shouldn’t.
    It appears memberpress only works with the_content, is there any way of getting it to work with ACF?
    Memberpress support said “contact the author and see if he/she has any filter hooks we could use to hide the output of the fields”

  • There are a lot of hooks in ACF that could be used to do a lot of things, and more than likely there is something, but I don’t think you’ve given me enough information to figure that out. How does Memberpress hide content in the editor? Is it done using a shortcode? Or does it simply hide all of the content if you’re not allowed to view it?

  • Hi john,very valid question and I’ll contact member press support for clarification.
    In the admin We set rules for each membership level – eg hide post, page etc if it logged in.
    If someone goes to one of these pages, they are redirected to the sign up/login page.

    Member press support also said “you should be able to use a PHP conditional (as long as there’s a Rule protecting that page) like <?php if(current_user_can(‘mepr-auth’)) { ?>”, however this just hides everything and doesn’t redirect to the sign up.

    I’ll email them with your question now as they are keen to find a way too.

  • So the issue is that if there are ACF fields on the page that the other plugin isn’t redirected?

    Or are you just trying to hide the content in the acf fields?

    Sorry, I’ve never used this plugin, but if it’s supposed to be redirecting if a user is not logged in then there’s nothing that I know of in ACF that would cause that to stop functioning. If you’re trying to hide only specific content on a page, then it should be hidden using the methods you’ve listed.

    Let me know if you hear anything.

  • Ah, interesting point you’ve made there. Is member press redirecting or just replacing the content with the sign up/login.
    I may be wrong in thinking its redirecting, I’ll check the page urls.

    If the content is in the default wysiwyg wp editor (the_content) it shows the sign up if not logged in.

    If the content is in a acf area, nothing happens, it still shows the content (or a blank page if the code I pasted above is used)

    I have asked member press to view this thread and let us know their comments.

  • 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?

  • Just checked and the default behaviour when using the standard wp wysiwyg is to replace the content with the sign up form.

  • @ukguy – While we look at our options here, you can setup a redirect instead here in your MemberPress Options:

    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)?

  • cartpauj, thanks!
    I changed the settings to redirect and that looks like it solves the issue!
    When it’s set to redirect, member press works on the page url and redirects to another page,so it doesn’t matter if the content is an acf or not so this could’ve the way round the issue.
    Thanks both for your help, much appreciated.

  • @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?

  • ACF fields and content are shown independently of the the_content.

    Usually, if you want to hide content if a user is not logged in you would do something like

      if (is_user_logged_id()) {
        // acf content output here

    There may be other ways to do this as well

  • Thanks John.

    James from support also sent me the info below, I’ve forwarded that in to Paul at member press to look at.

    “Thanks for the email.

    I had a look at the discussion and just to add my input perhaps you could have the guys over at Memberpress also hook into the acf_the_content global filter for getting the acf content within WYSIWYG custom fields.

    Please have a look at the following resource page for more info:

    I hope this helps.”

  • That could possibly work in some places, but it the goal is to hide all of the content on the page and replace it with a login form, content form ACF fields can be shown in many ways and that would only cover the content of one field. Most of the custom fields are shown, as you know, by adding additional HTML and templates that is not effected by the_content or acf_the_content. I think that the only way to ensure that nothing is output on the page is to add a conditional around all of the HTML and acf function calls so that the code is not run if the user must log in or is for some other reason not permitted to see the content and to only run the_content() in the template.

  • 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.

  • It is possible to use some of the simple text based fields in ACF using shortcodes in the content editor rather than altering templates, but I would not say this is how ACF is commonly used. By the sounds of the OP the theme being used outputs the fields in the template.

  • 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.

  • Hi guys, yes I confirm I’m using a custom built theme with template php tags to load the acf content into the relevant areas of the layout.
    Great info in this thread, I’ll review properly when back to work and try out some of the conditionals.
    The conditional dependent on membership levels sounds promising as potentially we could also show the relevant sign up form in a custom field based on membership.
    Many thanks

Viewing 17 posts - 1 through 17 (of 17 total)

The topic ‘Memberpress support’ is closed to new replies.