Is it possible to use CRED new user form and also create the "Use Preference"? Whats the best way to create a new user and CPT "User Preference" with this user like author?
Yes, sure. You need to hook into the Form Submit action, get the current user data or newly registered user data from the $_POST of the CRED Form, and then use this User data to populate the Posts' author meta.
The post will also be inserted during the same action.
To hook your Custom Code to CRED you use:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Then, within this hook you get the User ID with get_user_by(), using the User's email or username:
https://developer.wordpress.org/reference/functions/get_user_by/
After, you insert a new post (still within the CRED Save Data action) and pass the user ID as it's author:
https://developer.wordpress.org/reference/functions/wp_insert_post/
How can i limit users to create only 1 unique post "User Preference"?
Toolset does not support this out of the box.
Also, since you create your Post with an User Form and CRED API, the user will never be able to reach that form again (since the user now exists you do not expect him register again, right?)
Hence the risk of more than one post each user is equal 0.
If you want, you can as example wrap the link that leads to the User Register form in a HTML condition that uses a custom ShortCode or function, which checks if the user already has posts
Here an example for that:
/**
*Count posts of given type, so each user can create post only once
*/
function u_post_count() {
$user_post_count = count( get_posts( array(
'post_type' => 'your_post_type',
'author' => get_current_user_id(),
) ) );
return $user_post_count;
}
==> It will count all Posts of the current logged in user.
==> Make sure to define the Post type in 'post_type'
==> It returns a numeric count.
This can then be used in a HTML condition to hide or show things:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
How can i edit this link for this unique post to edit with CRED?
You create a CRED Edit form for this Post Type and add it to a Content Template.
Then you link to that Content Template with the Toolset ShortCode for CRED Edit Links:
https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/