One of the core functions of Memberium is to control access to the pages on your WordPress website based on the identity of the logged in member. This is useful when you want to prevent access to content, or to dynamically control what content is displayed to visitors based on the tags they have.
Sometimes you may want (or need) a finer detailed way to control access to parts of your page, or to display different content in areas of your pages to your members based on their tags. The most common way to check for tags is to use the [memb_has_all_tags] shortcode which does a loose check to see if the current user has any of the listed tags. Sometimes you need a more strict test and to determine if the user has ALL of a set of tags. For this case you would use [memb_has_all_tags].
ActiveCmpaign uses tags to segment your audience to make your marketing more effective. Similarly, you can use those same tags to control how Memberium behaves when your members login to the site.
Tag Names vs. Tag ID’s
Like it’s cousing [memb_has_all_tags], this shortcode can use either the Tag ID, or the Tag Name. You can find the tag names and IDs in ActiveCampaign, by going to CRM settings. Multiple Tag Names and ID’s can be used in a single shortcode by separating them with a comma. Do not include extra spaces after or before the comma.
The advantage of using Tag Names is that it makes the code VERY easy to read, which is useful when setting up and troubleshooting your shortcodes. No more guessing what Tag #781 is. Tag Names do require the tag to be unique int the system. Additionally the are more resilient to deletion since if you delete the tag, and recreate it and the shortcode will automatically work with the new tag.
The advantage of using Tag ID’s is that they’re unchanging and faster to process and more specific if you have multiple tags with the same name in different categories. Generally we recommend to NOT re-use the same tag name, but if you do you can specify the tag more accurately by using the Tag ID#.
A Note on Testing for Membership Levels
It is not recommended to use [memb_has_all_tags] to test for access to Membership Levels. Membership levels consist of a group of tags and a user’s membership level is determined by the mix of tags they have, not just the presence of the membership tag itself. If you need to test for membership levels, you should use the [memb_has_membership] shortcode instead, which is designed with the membership level concept in mind. Additionally there is the [memb_has_payf] shortcode for testing for the various PAYF tags.
Testing for ANY Tags
If you need to test to see if a user has ANY of the tags in a set, you should use [memb_has_any_tags] instead.
Usage Inside HTML Tags
As of WordPress 4.3, you cannot use open and closing shortcodes inside of HTML tags. We provide a parameter called “output”, to enable you to conditionally display output if the tag test succeeds. This is especially useful in HTML forms where you may want to add the attribute “selected” or “checked” to pre-select a form option.
[memb_has_all_tags] is a conditional shortcode. Conditional shortcodes perform a test and then display (or don’t display) the content within the shortcode depending on the result of the test. Conditional shortcodes are often nestable so that you can perform multiple tests. All tests are binary meaning they resolve to a simple true-false / sucess-fail / yes-no condition.
If you have a series of tests, one after another, you may need to nest your shortcodes.
Administrator accounts are always treated as successfully passing all tests. It is not possible to get a failure result as an Administrator. It is recommended that you create regular subscriber users to test the behavior of the site.