Skip Navigation

[Resolved] Import specific role user into CRED form for selection

This support ticket is created 5 years, 11 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Author
Posts
#1220633
Screenshot 2019-03-26 at 3.12.40 PM.png

Dear Sir/Madam,

I have a user role "Sales", custom post "Dealer", there is a custom field "Sales" associated with the custom post "Dealer".

I want to create a CRED form and hope the customer can select the list of user with role "Sales" to the custom field "Sales"

I temporary add the options in the custom field for selection. How can I do it automatically?

Best regards,

Kelvin.

#1220818

This is not possible.

What you can do is either manually populate such field and insert it in either the backend or a form (toolset form) of the post so users can pick one or several values each post, or, you can use this approach to relate users to posts:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

But this is a Post Type relationship, which will eventually not fit your needs.

Another approach can be to contact a Toolset Contractor and custom code the field you mention so it's populated with a row of existing users:
https://toolset.com/contractors/

#1220887

Dear Beda,

Many thanks for your advice, I think can I use the generic field and write some code to build a dropdown list for selection? What is the output format to the dropdown list for the generic field?

Best regards,

Kelvin.

#1220907
Bildschirmfoto 2019-03-26 um 19.39.17.png

Here we talk about Toolset Forms then (generic Fields)
Those fields accept valid JSON input as they state in their GUI.

This can meanwhile even be done with Toolset Views.
So you'd set up a Toolset View and produce a valid JSON output as the Toolset generic Field requires, and use that View as a shortcode to populate the Forms field.

#1220979

Dear Beda,

Yes, I do remember I have a ticket about this, there was some trick when building the JSON, how can I search it back as I have too many tickets.

#1220980

Dear Beda,

I found the ticket, https://toolset.com/forums/topic/fill-cred-field-by-selecting-type-custom-post/

May I keep this open till I solve it?

Best regards,

Kelvin.

#1221444

That ticket is very old, it is outdated.
Now you can simply check a box at the bottom of the view's loop editor to make the view raw.

This ticket here will stay open until the Toolset Cleanup robot will iterate it, and remind you of it.
If you comment, it will again stay open a while long, and so on.

Thanks!

#1221490
Screenshot 2019-03-27 at 6.11.32 PM.png

Dear Beda,

Do you mean I should make a View to list out all the user_id with a selected role and then put it into the CRED form as a dropdown selection?

Now you can simply check a box at the bottom of the view's loop editor to make the view raw.

I can't find the check box at the bootom of the View's loop editor you mentioned, could you instruct me how?

Best regards,

Kelvin.

#1221545

It is the checkbox "Disable wrapping DIV" that you see just below the Loop Editor (also visible on the Screenshot)

As you found earlier Generic Fields can be populated with JSON and JSON can be produced with Views if using the Wizard and choosing "List with separators" output mode.
Then make sure the Loop Content is actually generating the exact syntax as suggested by Toolset Forms.
For example, you can output a User Name as the label and a User ID as the value in the syntax and then use that View to populate your generic field to save that (with custom code applied to cred_save_data) in the database against the post.