Skip to main content

mbr_casetag

Usage

This shortcode determines the content to be included based upon a comparison of tags that the current remote user has to those in the shortcode conditions.

The shortcode will include content specified for the first condition that evaluates true as it works down the condition definitions.

With this shortcode tag based conditions can be specified similar to the PHP switch() function.

This shortcode can be used instead of using a series of [mbr_is_for] shortcodes, making your code both shorter and easier to manage.

Parameters

ParametersDescription
limit_elseIf set to "yes" and the user is not logged in or does not have any ActiveCampaign contact tags that define a membership as selected in [ActiveMember360, Settings, Memberships][settings-memberships] this parameter will cause the "ELSE" part of the shortcode to be suppressed. This can be useful in scenarios where the "ELSE" portion of the shortcode is only applicable to members of the site, for example excluding visitors who are not logged in.
Default: no.
Required: no.

Conditions

ConditionsDescription
tag:Followed by a single tag ID or tag name defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user has the tag the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
any_tags:Followed by multiple tag IDs or tag names in a comma separated string that are defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user has any of the tags the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
all_tags:Followed by multiple tag IDs or tag names in a comma separated string that are defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user has all of the tags the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
not_tag:Followed by a single tag ID or tag name defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user does not have the tag the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
not_any_tags:Followed by multiple tag IDs or tag names in a comma separated string that are defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user does not have any of the tags the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
not_all_tags:Followed by multiple tag IDs or tag names in a comma separated string that are defined within ActiveCampaign used to evaluate the condition. If the condition is true i.e. the remote user does not have all of the tags the content following the condition is returned. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas.
Default: none.
Required: no.
else:The default fallback if no other condition is met. This default fallback can only be used once.
Default: none.
Required: no.
Tag ID's vs. tag names

The use of tag ID's over tag names is encouraged. Unless a tag is deleted, its tag ID can be considered persistent and unique. Tag names, on the other hand, can be changed at any time and do not need to be unique. Using a tag name that is not unique or has been changed can cause your shortcode, hook or module to no longer work as expected.

Validity

This shortcode is only processed for logged in users who also exist as contacts within ActiveCampaign.

In all other cases, including WordPress users with the Administrator role and not logged in visitors nothing will be processed.

Conditional Branching

This shortcode does NOT support conditional branching with [ELSE_casetag].

Nesting

Shortcode nesting is NOT supported.

Examples

The content returned will be the that related to the first condition satisfied by the current remote user:

  1. If they have tag ID 195 'You have the tag ID 195' will be returned.
  2. If they do not have tag name MyTagName 'You do not have tag MyTagName' will be returned.
  3. If they do not have tag name MyTagName3 'You do not have tag MyTagName3' will be returned.
  4. If they have either tag ID 987 or tag name MyTagName2 'You have at least one of the given tags' will be returned.
  5. If they have either tag IDs 998 or 999 'You have at least one of the given tags' will be returned.
  6. If they do not have either tag ID 234 or tag name MyTagName4 'You do not have at least one of the given tags' will be returned.
  7. If they have all of tag IDs 678, 591 and tag name MyTagName4 'You have all the given tags' will be returned.
  8. If they have all of tag IDs 543, 432 and tag name MyTagName4 'You have all the given tags' will be returned.
  9. If they do not have all of the tags named MyTagName5 and MyTagName6 'You do not have all the given tags' will be returned.
  10. Otherwise 'None of the above applied to you' will be returned.
[mbr_casetag]
tag: 195
You have the tag ID 195
not_tag: MyTagName
You do not have tag MyTagName
not_tag: MyTagName3
You do not have tag MyTagName3
any_tags: 987,MyTagName2
You have at least one of the given tags
any_tags: 998, 999
You have at least one of the given tags
not_any_tags:MyTagName4,234
You do not have at least one of the given tags
all_tags: 678,MyTagName4,591
You have all the given tags
all_tags: 543,432,MyTagName4
You have all the given tags
not_all_tags: MyTagName5,MyTagName6
You do not have all the given tags
else:
None of the above applied to you
[/mbr_casetag]

API

Note

There is currently no ActiveMember360 API function equivalent for this shortcode.