[memb_compare] / [memb_if]

This Applies to
OTHER DOCS Available

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 (?)

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: Yes (?)
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 range
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.

You can read this article to see how [memb_if] shortcode can be used for creating a Credit System with Infusionsoft and Memberium.

  • Was this Helpful?
  • YesNo
9 ways to add more value to your membership site

[memb_compare / memb_if]

This Applies To

Book a Call

Welcome to Memberium!

We are very excited for you to be part of our family. 

We would love to answer any questions that you have!

Please choose the best time for you to get in a call with us. 

For Technical Support, you can contact us at https://memberium.com/support/ or Email us at support@memberium.com.