Skip to main content

Shortcodes

AMS Connect comes with a handful of shortcodes to troubleshoot and quickly render content.

Login/Logout Button

This shortcode renders out an SSO connected Login button when the user is logged out and a Logout button when they are logged in.

Usage

[amsc-login-button text="Log In" logout_text="Log Out" class="button"]

If you would like for it to just output a login or logout URL, you can use the link_only attribute.

[amsc-login-button link_only="true"]

Debug Data

This shortcode outputs debugging data that can be useful for troubleshooting the AMS configuration. You can embed this anywhere in WordPress.

Usage

[amsc-debug]

NOTE: This data is also output on the SSO User Debugging Url that is accessible from the AMS Connect dashboard and is usually at the following path: /wp-login.php?action=amsc_debug

AMS User Data

This shortcode is a quick shorthand for outputing user data. Most page builders will have a module or block for this, so this shortcode is purely for convenience if you don't have another way to render the data.

Usage

[ams-user key="first_name"]

Output the user's current membership by accessing the amsc_membership_type user meta field:

[ams-user key="amsc_membership_type"]

Or the user's current membership expiration date

[ams-user key="amsc_membership_expiration"]

Fomatted Date

Another utility shortcode that is useful when building time based layouts. It renders out the date, by default, as a Unix timestamp. This format is very amenable to comparisons such as revealing layouts or modules based on a membership expiration date.

Usage

For example, this will render a date exactly 3 months in the future. This can be useful to determine if a user's membership is within 3 months of expiration.

[amsc-date date="+3 months"]

The output of this shortcode can be compared to the membership expiration in a display logic screen in page builders like Gutenberg, Beaver Builder, of Elementor. For example, the logic might be as such:

{IF} [ams-user key="amsc_membership_expiration"] {IS LESS THAN} [amsc-date date="+3 months"] {SHOW THIS BLOCK}