Skip Navigation

[Resolved] Logged in User details to automatically go into forms

This support ticket is created 5 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1392993

I have created a staff portal and want people to be able to fill in forms without having to re-enter their details every time.

I have set up a user login with username realname etc.

I have a CPT called Profile which holds phone, address, etc

I have set up a CPT called documents where they upload documents for all logged in users to read

In the Form for uploading documents, I would like the name of the staff member name to automatically go into the name field. Is there a way to do this?

I would like to use this feature extensively through the site with different fields from the profile CPT

#1393111

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Jane

For the fields in your form you can provide a default value (in the GUI when editing the form in visual mode, by adding a value attribute when editing in expert mode).

You can use shortcodes to generate these default values.

This is straightforward if the fields are part of the user profile (either standard fields such as Display Name or email, or custom fields).

You would use the wpv-user shortcode to provide the default value from the current user (i.e. the person submitting the form), e.g.

[wpv-user field="display_name"]

See https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user for more options.

It becomes more complex if you want to insert fields from a profile CPT connected to the user, which I can expand on if you specifically require that.