mbr_not_for
Usage
This shortcode determines the content to be included based upon a comparison of ActiveCampaign tags that the visitor has to the conditions defined in the shortcode parameters.
An alternative to using a series of [mbr_not_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 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. |
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 TRUE and show the content.
Conditional Branching
[ELSE_not_for] conditional branching is supported.
Nesting
Shortcode nesting is supported:
[mbr_not_for1] thru [mbr_not_for19]
[ELSE_not_for1] thru [ELSE_not_for19]
[/mbr_not_for1] thru [/mbr_not_for19]
Examples
- Example 1
- Example 2
- Example 3
The content returned will be 'You do not have any of the tags' if the current remote user has none of the ActiveCampaign tags 123,456 or MY TAG NAME:
[mbr_not_for tags='123,456,MY TAG NAME']
You do not have any of the tags
[/mbr_not_for]
The content returned will be 'You do not have any of the tags' if the current remote user has none of the ActiveCampaign tags 123,456 or MY TAG NAME otherwise 'You may have one of the tags' is returned:
[mbr_not_for tags='123,456,MY TAG NAME']
You do not have any of the tags
[ELSE_not_for]
You may have one of the tags
[/mbr_not_for]
The content returned will be 'content-content-content' if the current remote user has ANY of the tags 123,456 and 789 AND has NONE of the tags 43,65 and 87. Otherwise 'alternate-content-alternate-content' will be returned but only if the current current remote user has ANY of the tags 123,456 and 789, otherwise nothing will be returned:
[mbr_is_for1 tags='123,456,789']
[mbr_not_for2 tags='43,65,87']
content-content-content
[ELSE_not_for2]
alternate-content-alternate-content
[/mbr_not_for2]
[/mbr_is_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' )