mbr_is_for
Usage
This shortcode determines the content to be included based upon a comparison of ActiveCampaign tags and/or contact ID that the visitor has to the conditions defined in the shortcode parameters.
An alternative to using a series of [mbr_is_for] shortcodes for ActiveCampaign tag conditions is to use the [mbr_casetag] shortcode, which can make your code both shorter and easier to manage.
Parameters
Parameters | Description |
---|---|
tags | One or more tag ID's or tag names defined within ActiveCampaign and used to evaluate the condition. This condition evaluates as true if the remote user has any of the tags specified. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas. Default: none. Required: yes if parameters exclude_tags , only_cid or exclude_cid are not specified. |
require_all_tags | Specifies whether ALL tags specified using the tag parameter must be present in order to satisfy the condition.Permitted Values: yes, no Default: no Required: no. |
exclude_tags | One or more tag IDs or tag names defined within ActiveCampaign and used to evaluate the condition. This condition evaluates as true if the remote user has none of the tags specified. The available tags can be found in ActiveMember360, Utilities, Tags. If more than one is entered, please separate with commas. Default: none. Required: yes if parameters tags , only_cid or exclude_cid are not specified. |
only_cid | One or more contact IDs that exist within ActiveCampaign and used to evaluate the condition. This condition evaluates as true if the remote user has a contact ID matching any of those specified. If more than one is entered, please separate with commas. Default: none. Required: yes if parameters tags , exclude_tags or exclude_cid are not specified. |
exclude_cid | One or more contact IDs that exist within ActiveCampaign and used to evaluate the condition. This condition evaluates as true if the remote user does not have a contact ID matching any of those specified. If more than one is entered, please separate with commas. Default: none. Required: yes if parameters tags , exclude_tags or only_cid are not specified. |
limit_else | If 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. Permitted Values: yes, no Default: no Required: no. |
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 evaluated for any type of visitor.
For a local WordPress user with the Administrator role the shortcode will always evaluate as TRUE.
For public visitors or other local WordPress users the shortcode will always evaluate as FALSE and show the [ELSE_is_for] content unless the limit_else
parameter is specified in which case nothing will be returned.
Conditional Branching
[ELSE_is_for] conditional branching is supported.
Nesting
Shortcode nesting is supported:
[mbr_is_for1] thru [mbr_is_for19]
[ELSE_is_for1] thru [ELSE_is_for19]
[/mbr_is_for1] thru [/mbr_is_for19]
Examples
- Example 1
- Example 2
- Example 3
- Example 4
- Example 5
- Example 6
- Example 7
The content returned will be 'You have at least one of the tags' if the current remote user has ANY of the ActiveCampaign tags 123,456 or MY TAG NAME:
[mbr_is_for tags='123,456,MY TAG NAME']
You have at least one of the tags
[/mbr_is_for]
The content returned will be 'You have at least one of the tags' if the current remote user has ANY of the ActiveCampaign tags 123,456 or MY TAG NAME otherwise 'You do not have any of the tags' is returned:
[mbr_is_for tags='123,456,MY TAG NAME']
You have at least one of the tags
[ELSE_is_for]
You do not have any of the tags
[/mbr_is_for]
The content returned will be 'The Inner Circle content' if the current remote user is not one of the ActiveCampaign contacts with contact ID 56 or 43 AND has ANY of the tags 123,456 or MY TAG NAME. Otherwise 'Join the Inner Circle' is returned:
[mbr_is_for tags='123,456,MY TAG NAME' exclude_cid='56,43']
The Inner Circle content
[ELSE_is_for]
Join the Inner Circle
[/mbr_is_for]
The content returned will be 'Personal Mentoring content' if the current remote user is one of the ActiveCampaign contacts with contact ID 4321, 6543 or 9876 AND has ANY of the tags 123,456 or MY TAG NAME:
[mbr_is_for tags='123,456,MY TAG NAME' only_cid='4321,6543,9876']
Personal Mentoring content
[/mbr_is_for]
The content returned will be 'Gold & Platinum Member content' if the current remote user has ANY of the tags 456 or 789. Otherwise 'You are a Silver Member please upgrade to see content' will be returned but only if the current current remote user is a member of the site, otherwise nothing will be returned:
[mbr_is_for tags='456,789' limit_else='yes']
Gold & Platinum Member content
[ELSE_is_for]
You are a Silver Member please upgrade to see content
[/mbr_is_for]
The content returned will be 'Having now received three monthly newsletters we can offer you some free issues that you missed' if the current remote user has ALL of the tags 123,456 and 789 AND has NONE of the tags 87,65 and 43. Otherwise 'As a member you can buy any of our previous monthly newsletters here' will be returned but only if the current remote user is a member of the site, otherwise nothing will be returned:
[mbr_is_for tags='123,456,789' require_all_tags='yes' exclude_tags='87,65,43' limit_else='yes']
Having now received three monthly newsletters we can offer you some free issues that you missed.
[ELSE_is_for]
As a member you can buy any of our previous monthly newsletters here
[/mbr_is_for]
The content returned will be 'content-content-content' if the current remote user has NONE of the tags 123,456 and 789 AND has ANY of the tags 43,65 and 87. Otherwise 'alternate-content-alternate-content' will be returned but only if the current current remote user has NONE of the tags 123,456 and 789, otherwise nothing will be returned:
[mbr_not_for1 tags='123,456,789']
[mbr_is_for2 tags='43,65,87']
content-content-content
[ELSE_is_for2]
alternate-content-alternate-content
[/mbr_is_for2]
[/mbr_not_for1]
API
For ActiveCampaign tag conditions ActiveMember360 provides the PHP conditional function:
(mbr_has_tags( $tags, $mode ))
Parameters
Parameters | Type | Description |
---|---|---|
$tags | (string|array) | One or more tag ID's or tag names defined within ActiveCampaign and used to evaluate the condition. Default: none. Required: no. |
$mode | (string) | Specifies whether the current remote user must have ANY or ALL tags specified using the $tags in order to satisfy the condition. Permitted Values: any, all, any Default: any Required: no. |
Return
(bool) True if the current remote user satisfies the condition. False otherwise.
API Examples:
- e.g. a
- e.g. b
- e.g. c
- e.g. d
- e.g. e
- e.g. f
- e.g. g
- e.g. h
Statement evaluates as TRUE if the user HAS tag 123.
mbr_has_tags( '123' )
Statement evaluates as TRUE if the user HAS tag 123 OR 234.
mbr_has_tags( '123,234' )
Statement evaluates as TRUE if the user HAS tag 123 OR 234.
mbr_has_tags( array(123,234) )
Statement evaluates as TRUE if the user HAS tag 123 AND 234.
mbr_has_tags( '123,234', 'all' )
Statement evaluates as TRUE if the user HAS tag 123 AND 234.
mbr_has_tags( array(123,234), 'all' )
Any function preceded with an exclamation mark ! specifies the negative use case of the function.
Statement evaluates as TRUE if the user DOES NOT HAVE tag 123.
!mbr_has_tags( '123' )
It is also possible to combine conditions with && (representing AND) and || (representing OR).
Statement evaluates as TRUE if the user HAS tag 123 AND DOES NOT HAVE tag 234.
mbr_has_tags( '123' ) && !mbr_has_tags( '234' )
Statement evaluates as TRUE if the user HAS tag 123 OR DOES NOT HAVE tag 234.
mbr_has_tags( '123' ) || !mbr_has_tags( '234' )