Keap
Also available forActiveCampaign

[memb_if]

Summary
This shortcode lets you compare two pieces of information so that you can make decisions about what to display on the page.

Description

This shortcode lets you compare two pieces of information so that you can make decisions about what to display on the page. [memb_if] and [memb_compare] are two names for the same shortcode.

Shortcode Examples

Test if two values are equal:

[memb_compare value1="foo" test="==" value2="bar"]
Success!
[else_memb_compare]
Failure!
[/memb_compare]

Comparing a contact field:

[memb_if value1="{{contact.Country}}" test="==" value2="United States"]
Success!
[else_memb_if]
Failure!
[/memb_if]

Comparing a contact custom field:

[memb_if value1="{{contact._MyCustomField}}" test="==" value2="MyValue"]
Success!
[else_memb_if]
Failure!
[/memb_if]

Only succeed on certain days:

[memb_if value1="{{date.N}}" test="in" value2="1,2,3"]
Success!
[else_memb_if]
Failure!
[/memb_if]

Conditionally check an HTML radio button (New in 2.44.53):

<input type="radio" name="_MyCustomField" value="1" [memb_if value1="{{contact._MyCustomField}}" test="in" value2="MyValue" output=" checked=checked "] />

Conditionally select an HTML dropdown item (New in 2.44.53):

<option value="Example" [memb_if value1="Example" test="in" value2="{{contact._MyCustomField}}" output=" selected=selected "]>Example</option>
<option value="Example2" [memb_if value1="Example2" test="in" value2="{{contact._MyCustomField}}" output=" selected=selected "]>Example2</option>
<option value="Example3" [memb_if value1="Example3" test="in" value2="{{contact._MyCustomField}}" output=" selected=selected "]>Example3</option>

Shortcode Parameters

value1The first value to compare. Supports merge fields like {{contact.FirstName}}. (Required)
value2The second value to compare against. Can be a literal value or a merge field. (Required)
testThe comparison operator to use. Defaults to = (equality). See the operators table in Additional Information for all options.
caseinsensitiveWhether to perform case-insensitive text comparisons. Defaults to yes. Set to 0 to disable.
notReverses the result of the comparison. Use not="not" to invert the match.
outputValue to output if the test is successful, instead of displaying the enclosed content.
txtfmtA comma-separated list of text processing functions to apply to the output.
captureCaptures the shortcode output and routes it to a variable for later use.

Additional Information

This shortcode defaults to case-insensitive comparisons for text data.

equal==orEQ
greater thanGT
less thanLT
greater or equalGE
less or equalLE
not equal!=orNE
begins with~=orBW
ends with=~orEW
contains~~orCONTAINS
inin
not in!in
between two valuesrange
not between two values!range

When using range or !range, value2 must be the comma-separated minimum and maximum values to test against.

When using in or !in to test multiple values, value2 must be a comma-separated list of values to match against.

Shortcode Attributes

ConditionalYes
NestableYes
Accepts formattingYes
CapturableYes