Set Gutenberg Block Display Based Upon Conditional PHP Statement

Specifying visibility conditions for Gutenberg block based upon conditional PHP statement
Steps for specifying visibility conditions for Gutenberg block based upon conditional PHP statement
  1. Locate the PHP Statement section in Gutenberg editor block settings, iMember360.
  2. From the Control mode drop down ensure Individual is selected.
  3. Define the PHP conditional statement.

    Any valid PHP conditional function can be used.

    iMember360 has conditional functions that can be used:

    i4w_has_tags()

    Here are some examples:

    a. Statement evaluates as TRUE if the user HAS tag 123.
    i4w_has_tags( '123' )
    b. Statement evaluates as TRUE if the user HAS tag 123 OR 234.
    i4w_has_tags( '123,234' )
    c. Statement evaluates as TRUE if the user HAS tag 123 OR 234.
    i4w_has_tags( array(123,234) )
    d. Statement evaluates as TRUE if the user HAS tag 123 AND 234.
    i4w_has_tags( '123,234', 'all' )
    e. Statement evaluates as TRUE if the user HAS tag 123 AND 234.
    i4w_has_tags( array(123,234), 'all' )

    Any function preceeded with an exclamation mark ! specifies the negative use case of the function.

    f. Statement evaluates as TRUE if the user DOES NOT HAVE tag 123.
    !i4w_has_tags( '123' )

    It is also possible to combine conditions with && (representing AND) and || (representing OR).

    g. Statement evaluates as TRUE if the user HAS tag 123 AND DOES NOT HAVE tag 234.
    i4w_has_tags( '123' ) && !i4w_has_tags( '234' )
    h. Statement evaluates as TRUE if the user HAS tag 123 OR DOES NOT HAVE tag 234.
    i4w_has_tags( '123' ) || !i4w_has_tags( '234' )

    You can also use any conditional tags including WordPress and WooCommerce conditional tags.

    A list of WordPress Conditional Tags can be found here:

    WordPress Conditional Tags

    A list of WooCommerce Conditional Tags can be found here:

    WooCommerce Conditional Tags

    i. Statement evaluates as TRUE if this is the home page.
    is_home()
  4. Ensure the required block display to be used with this condition has been specified as detailed here:

    Set Gutenberg Block to Display Always or Never or Based Upon User Login Status

  5. Once the settings have been completed ensure Publish or Update is clicked to save the configuration.

Set any additional conditions for the block display as detailed here:

Set Gutenberg Block Display Based Upon Infusionsoft Contact Tag/Tags
Set Gutenberg Block Display Based Upon Infusionsoft Contact Field Value