>Tell us what you are trying to do?
a todo list like application which can be edit in the frontend & is connected to users.
the logged in user can then attach tasks to another user
My problem here is:
how can i integrate a "selection field" with all currently registred users in "Custom Post Type" (Todo: Add New Task) Frontend Form. And connect then the Tasks to the user.
>Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/how-to-create-custom-searches-and-relationships-for-users/
Thank You for looking in to it.
Best regards
Sammy.
how can i integrate a "selection field" with all currently registred users in "Custom Post Type"
Hi, there are 2 basic ways to connect Users and Posts:
1. Make the User the author of the post.
2. Create a Custom Post Type (something like "Workers") that represents Users, and connect Workers and Tasks using a post relationship. I call this a "proxy" post type.
#1 is more difficult because changing the post author requires custom code. You must create a generic field in your Form. The generic field must include options created by a View of Users. Then you must use the Forms API to set the author of some post to match the User selected in the generic field.
https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://codex.wordpress.org/Function_Reference/wp_update_post
#2 requires no custom code, but it requires two custom post types: Tasks and Workers. Set up a one-to-many post relationship between Workers and Tasks. Workers should be parents of Tasks.
When Users sign up, they must create a new Worker post like in the documentation: https://toolset.com/documentation/user-guides/how-to-create-custom-searches-and-relationships-for-users/#how-do-i-prevent-users-from-creating-more-than-one-contractor-post
Then when a Task is created or edited using Forms, any User can choose a different Worker as the parent of the Task.