How to use WordPress user data in your form

Use our WordPress addon to make WordPress user data accessible for the hidden field block in Tripetto, so you can use that data inside your form.

The concept

We regularly get the request if it's possible to use the basic data of logged in WordPress users inside Tripetto forms, for example to show the name of the user.

This is indeed possible by saving that user information in a way that the hidden field block of Tripetto can access that data. To help you with that we developed a small WordPress addon that makes the user data accessible. In this article we will help you to set this up.

At own risk

This addon is just to help you access the data. It's not part of the Tripetto platform/plugin.

The addon inserts the user data in JavaScript variables that are written inside your website code. Only use this addon for pages where you need to access this data with a Tripetto form.

Install addon

Follow these steps to install the addon as a plugin:

  1. Download this ZIP file containing the addon;
  2. Optional: By default the addon makes all user data accessible. If you only want to access particular user data, you can modify the plugin so only the desired fields are used in the plugin;
  3. Install the addon to your WordPress Admin:
    Click PluginsClick Add NewClick Upload PluginSelect the downloaded ZIP fileClick Install NowAfter installation click Activate Plugin.
You'll now see the addon (Tripetto - Addon to access WordPress user data) in your list of Installed Plugins.

Setup shortcodes

Example of the two shortcodes in a page.

Follow these steps to setup the shortcodes:

  1. Make sure the mode of your Tripetto form shortcode is set to inline, like this: mode='inline'. More information about the shortcode can be found in this help article;
  2. Add the shortcode of the addon [tripetto-wp-user-data] to the desired post/page. The position of this shortcode doesn't matter.

Receive user data with hidden field(s)

Example of a hidden field block reading the display name.

Now your Tripetto form can read the user data variables using the hidden field block. More information about the hidden field block can be found in this help article.

To read the user data, setup the hidden field as follows:

  • Name - The name you want to give the hidden field;
  • Type of field - Select Global JavaScript variable;
  • Name of variable - Enter the desired variable out of this list:
    • tripetto_wp_user_login;
    • tripetto_wp_user_firstname;
    • tripetto_wp_user_lastname;
    • tripetto_wp_user_displayname;
    • tripetto_wp_user_email;
    • tripetto_wp_user_id.
Now the value of the variable will be stored inside this hidden field block.

Possibilities of hidden field block

You can also use the values of hidden fields in your form, for example for piping logic, or branch logic. More information about the hidden field can be found in this help article.

Use these helplines if you have any questions, problems or requests