Keap
Also available forActiveCampaign

[memb_if_request]

Summary
This shortcode requests for a specified information within a URL and displays a message accordingly.

Description

This is a conditional shortcode that checks whether a $_REQUEST variable (GET, POST, or COOKIE data) exists or matches a specific value, then displays content accordingly. It uses an [else_memb_if_request] block for the fallback when the condition is not met.

Shortcode Examples

Check if a request variable named source equals google:

[memb_if_request key="source" test="=" value="google"]
    Welcome from Google!
[else_memb_if_request]
    Welcome!
[/memb_if_request]

Check if a request variable exists at all:

[memb_if_request key="promo"]
    Your promotion has been applied.
[else_memb_if_request]
    No promo code found.
[/memb_if_request]

Check if a submitted value begins with a specific string:

[memb_if_request key="coupon" test="bw" value="SUMMER"]
    Summer discount applied!
[else_memb_if_request]
    Invalid coupon.
[/memb_if_request]

Shortcode Parameters

key(Required) The $_REQUEST variable name to check.
test(Optional) Comparison operator. Default: =. Valid operators: =, ==, ===, eq, ne, !=, !==, gt, >, lt, <, ge, >=, le, <=, bw (begins with), ew (ends with), contains, in, !in, range, !range.
value(Optional) The value to compare against. If omitted and test is empty, checks for the key’s existence only.
caseinsensitive(Optional) Whether to perform a case-insensitive comparison. Default: true.
captureCaptures the shortcode output and routes it to a variable for later use.
txtfmt(Optional) Comma-delimited list of text processing functions to apply to the output.

Additional Information

The $_REQUEST superglobal merges $_GET, $_POST, and $_COOKIE data, so this shortcode can match values regardless of how they were transmitted. If value is omitted and test is empty, the shortcode checks for the key’s existence only.

Shortcode Attributes

ConditionalYes
NestableYes
Accepts formattingYes
CapturableYes