Home › Forums › General Issues › Memberpress and ACF
I running the latest version of WordPress with ACF Pro.
I have a client that is moving their CRM from Constant Contact to Fluent CRM because of cost and database management. In the process, they would like to streamline their membership process by using the plugin Memberpress which allows the Admin to limit access to some information on the site to members only and seamlessly integrates with Fluent CRMs user lists.
One issue I ran into is that this limiting of content is based on WordPress content(); function and won’t hide the content stored in any of the ACF fields which the site relies on heavily in its templating structure.
They do offer the ability to wrap content in a PHP conditional – but this seems a bit cumbersome as each conditional has a rule ID associated with it.
<?php if(current_user_can('mepr-active','rules:10463')): ?> Content <?php endif; ?>
Any help would be much appreciated. Thank you in advance.
This is not different then many other things. For example, requiring login or a password to view content of the page only works with the WP content field and you must wrap anything else in conditionals that check this.
I have a client that uses a 3rd party application for memberships. Users must login through the 3rd party site. I had to build an API integration that checks that login so that the client can control what content people can see on the site. The entire site depends on ACF and does not use the standard WP content anywhere.
One upside of what you have is that they have a WP plugin that gives you functions for checking these.
My suggestion would be to figure out if you can create an ACF field that allows selecting the rules for seeing the content then rather than hand coding rules you can use the value of this field in your conditional. This is similar to what I had to do above. There are many Types of members, none of this is hard coded. There is a function in my API connection class that takes a member type entered into an ACF field and calls a method in in my API class to check if the current user can view the content based on that type.
Sorry I can’t offer more help because I don’t know anything about Memberpress or Fluent CRM.
Thanks, John – that gets me started. I definitely wanted to avoid hardcoding anything – this is going to push my knowledge for sure…but am always willing to learn new things. Thanks again for your response.
You must be logged in to reply to this topic.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.