Skip Navigation

[Resolved] Reference from data submitted at registration form field to field in post form

This support ticket is created 4 years, 7 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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 4 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1576361

Hi,

Is it possible and if yes, how to have reference from data submitted at registration form field to field in post form (for one and the same logged user).

Contextual example:
- registration form with custom single line text filed - "Company name"
- post form that gets and displays the content from the "Company name" field

BR,

P

#1576587

Hello,

Please elaborate the questions with more details:

post form that gets and displays the content from the "Company name" field

What kind of post form are we talking about? How do you setup this post form?

I assume we are talking about this:
1) Custom post type "Company"
2) You are going to connect WordPress users with Company post, for example:
One "Company" can connect with multiple WordPress users

If it is, there isn't such a built-in feature within Toolset plugins, Toolset post type relationships are based on post types, as a workaround you can setup a intermediate post type, use it to connect with other post types.

For example:
1) Two post types:
- Company
- Member
Each "Member" post's author is different wordpress user, one WordPress user can have only one "Member" post

2) Setup one-to-many relationship between post types "Company" and "Member"

3) After user register and logged in your website, redirect him to a WordPress page, display below post view:

4) Create a post view:
- query "Member" posts
- filter by post's author is same as logged-in user:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-author/
- If there is post found, display the Member post information + it's parent company post information:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-one-related-item-parent
If there isn't any post found, display below post form for creating new "Member" post:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

More help:
How to Create Custom Searches and Relationships for Users
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

#1582267

Hi,

Let me provide more details for the context.

I am creating a job portal. The users are two types - employers and candidates. Every user must register and then compete a profile with more details.

When a employer registers to the job portal, the employer submits short registration form with custom field for the actual "Company name".

After that every employer creates/publishes company profile (post form) where the data from the "Company name" custom field (the actual company name) should be automatically loaded into the post.

I am trying to figure out how to take the actual company name (for example ABC) from the already submitted registration form of the employer and to post it as pre-populated part in the company profile post.

BR,

Petar

#1583569

I assume we are talking about this case:
1) Custom user field "company-name" created with Toolset Types plugin
2) A post form for creating "company profile" post

You are going to display the custom user field "company-name" in above post form.

If it is, this is possible, you can get current user's "company-name" field value with Types shortcode:
[types usermeta='company-name' user_current='true'][/types]
https://toolset.com/documentation/customizing-sites-using-php/functions/

Within Toolset post form, you can use above shortcode to pre-populated the field default value, for example:
[cred_field ... value="[types usermeta='company-name' user_current='true'][/types]"]

More help:
https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred_field
value: Preset value

#1585817
Img1.PNG

I will need here a little bit more guidance : Is this the code [cred_field ... value="[types usermeta='company-name' user_current='true'][/types]"] that I have to put in the default field value filed at the specific reference field settings the custom post form? Is there anything else that have to be done?

#1586105

In your screenshot, option "Default field value", you can fill below shortcode:
[types usermeta='company-name' user_current='true'][/types]

Then test again. please make sure your custom user field slug is "company-name".