Get Parameter Value from URL

Hi all,

I am wondering if it’s possible to retrieve the value (‘123456’) associated with the parameter in a URL (e.g. in “&code=123456”) and use it with an ‘If’ logic to display something if the value matches the user meta.

I wasn’t sure if the URL query feature simply retrieves the query parameter and not the value.

Regards.

I just modified the Url tag documentation a tiny bit to clarify this:

Use the query attribute to get a parameter value by referencing its name:

<Url query=color />

So in your case if your URL is mysite.com/?code=123456 you could get the value with <Url query=code />. If you wanted to pass that to the If tag, it might look something like this:

<If check="{Url query=code}" is value="{User custom_field_name}">
  The URL parameter matches your user field.
</If>

or maybe

<If user_field="custom_field_name" is value="{Url query=code}">
  The URL parameter matches your user field.
</If>
2 Likes

Hi @benjamin

Thanks heaps for that. That has worked for me. :slightly_smiling_face:

Appreciate the update in the documentation.

Regards.

2 Likes