Skip Navigation

[Resolved] What is the key for a specific user field checkbox?

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Waqar 2 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2356339
fields.jpg

I'm using a Gravity Form for user registration and have successfully mapped a custom user field (single textbox) from the registration form to a user field which I created with Toolset called "test-field." This works correctly. When a user registers via the Gravity Form the info is saved to the user field. So far so good.

However I need to do this with a checklist.

I've already created the custom checklist as a user field in Toolset, and I added the same checklist with the same values to my registration form. The checklist is called "Credentials" and features a list of credentials MD, DO, PhD, etc.

In the Gravity Forms Registration settings I tried mapping wpcf-credentials to Credentials (selected) which is the title of the field in GF and appears in the pre-populated dropdown, but this didn't work.

I'm assuming this may be because each checkbox needs to be individually mapped?

The name of each checkbox does does not appear in the Key dropdown, but I tried selecting Custom Meta where I entered "wpcf-credentials-md" (which I thought might be the key for the specific checkbox) and then selecting MD (which is pre-populated in the Value dropdown. But this didn't work either.

I've already confirmed via the Gravity Form that the values are successfully being passed, and as I mentioned the single text field works for me – so I think it's likely that I just need to map each respective Value in the checklist to whatever key Toolset assigns that checkbox.

a) Does that sound right?

b) What would the key for a specific checkbox be?

For instance if I have MD as a checkbox in the wpcf-credentials list and it's value in Toolset is credentials-md. Would there be a key called wpcf-credentials-credentials-md? Or something similar.

I'm including a screenshot of the options, so you can see what I'm working with.

Thank you for your help,

#2356883

Hi,

Thank you for contacting us and I'd be happy to assist.

The field mapping like this will work for the simple text fields like the single line type fields, but not for the complex fields like checkboxes and radio buttons, etc.

Toolset stores the values of the options of these complex fields in a serialized form within the single custom field key ( e.g. wpcf-credentials ). For this reason, it won't be possible to use those fields with a third-party form like Gravity Form. For entry into these complex fields, you'll need to use the Toolset Forms.

regards,
Waqar

#2357227

Okay, I'm rebuilding the user registration field as a Toolset form.

But I still need to set custom user meta fields for RCP_status to "active" and RCP_subscription_level to "1".

I see where I can add hidden fields to the Toolset form with these values.

But how do I map those values to the appropriate key in Toolset?

#2357229

Also, our site is built on Divi, so now that the Form is built how do I add it without the Gutenburg editor?

#2357231

...you can disregard my last question. The documentation seemed to require Gutenburg, but I just realized it can be added with a shortcode. So that's solved. Just need an answer to question about saving a hidden field as custom meta.

#2357399

As an FYI the rcp_subscription_level and rcp_status user meta fields are not displaying on the "Manage non-Toolset User Fields with Toolset Forms" page.

So to summarize. Our users can register with the Gravity Form registration we created and be added to our Restrict Content Pro membership, but then none of the Toolset user checkboxes can be saved, because as you said they are saved in a serialized form.

Or they could register via the Toolset form I just built which does save the user fields, but they aren't added to the Restrict Content Pro membership which needs the rcp_subscription_level user meta key set to a value of 1.

If we can solve the latter issue we might have a workable solution.

Although I just discovered Toolset doesn't User Activation by Email which is another pro for the Gravity Form approach.

#2359085
generic-field-with-persist.png

Thanks for writing back.

When working with the Toolset Forms, you can use a hidden generic field ( ref: https://toolset.com/lesson-placement/lesson-placements-1621521-1620257/ ) to save a user field value into a non-Toolset field.
( example screenshot attached )

Note: Please make sure that the option "This field value is an user ID, and should be included in the list of available recipients for notifications" is checked, otherwise the user field value will be available in the user form, but it won't actually be saved in the database.

If you're editing the form in expert mode, this generic field's shortcode will look like this:
( ref: https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_generic_field )


[cred_generic_field type='hidden' field='rcp_subscription_level']
{
"default":"1",
"generic_type":"user_id",
"persist":1
}
[/cred_generic_field]

Note: In this case, the '"persist":1' attribute tells the form to save the generic field's value in the database.

You can add more generic fields in the same way, as needed.