[memb_compare / memb_if]

Version Added 2.0

Summary

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

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 tem (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

capture:  Lets you capture the output of this shortcode and route it to the destination of your choice (?)

caseinsensitive:  Defaults to yes.  Set to 0 to disable.  (Optional)

not:  Reverses the result of the check.  Use format not=not (Optional)

output:  Value to output if the test is successful (Optional)

value1:  The first value to test (Required)

value2:  The second value to test (Required)

test:  Style of comparison or test to perform.  Defaults to equality check.

txtfmt:  Lets you process the output of this shortcode through text processing functions (?)

Description

This shortcode is used do tests on two values using one of several different methods of comparison, and return different outputs conditionally based on the results.

Either value can be a variable.

You can test to see if a value belongs to a group of values by using the “in” or “!in” (not in) tests, and by making value2 a comma separated list of values to match against.

The “in” and “!in” tests were added in 2.44.36

The “output” parameter was added in 2.44.53

Shortcode Attributes

Conditional: No (?)
Nestable: No (?)
Accepts formatting: No (?)
Capturable: No (?)

Additional Information

[memb_if] is another name for [memb_compare]

This shortcode defaults to case in-sensitive comparisons for text data.

equal == or EQ
greater than GT
less than LT
greater or equal GE
less or equal LE
not equal != or NE
begins with ~= or BW
ends with =~ or EW
contains ~~ or CONTAINS
in in
not in !in
between two values inrange
not between two values !inrange

When using “inrange” or “!inrange” 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.

ActiveCampaign Shortcode Documentation

Looking for info on the ActiveCampaign version of this shortcode?

Click Here to View the ActiveCampaign Shortcode Documentation

Memberium Membership Site Workshop
October 10th-12th, 2018 in Phoenix, Arizona

Get your Memberium site and Infusionsoft app fully implemented in 3 days. Save $100 OFF your ticket until the end of this Monday, September 24th!

Click Here to Learn More and Reserve Your Seat