I'm building a site that allows registered users to contribute stories, which are grouped by post categories (country names).
Under user profile, I would like to allow users to tag countries they have visited or planning to visit in future.
With that said, when visitors look at a country archive, they can see stories related to the country, as well as users who are interested in the countries.
I understand WordPress doesn't allow sharing of taxonomy between cpt and users. And I saw a suggestion from this forum, which is to create a cpt for user (eg Profile). While this sounds like a feasible plan, the problem I imagine will face next is, how do I control each registered user creates only one profile? Better still, to automatically create a profile each time someone register a new user account?
Yes, that is correct, to create relationships or even just add Taxonomies to a User, you need to "convert" that user to a Post Type.
That's explained here:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
All doubts you mentioned are cleared in that DOC.
After, you can create an archive for the Countries (which is a taxonomy) and in there, include the User and Countries posts.
Thank you Beda for the link to the doc. It does answer the question I had! I must really learn to search the Documentation section!
I haven't tried the solution yet, but I imagine the next challenge I may face, is to make it a more seamless process from creating user account to posting content. Because from the doc, user needs to create Contractor profile (second step) before he/she can proceed to create contractor post (ultimate objective).
I wonder if there is a way I can merge both processes in a single step ie when user registers for user account, a profile is automatically created. He/she may choose to fill in the additional details later, but he/she should be able to proceed to create post right after successful login. Will you advise?
Hello,
For the question:
if there is a way I can merge both processes in a single step ie when user registers for user account, a profile is automatically created
No, there isn't such a built-in feature within Toolset form plugin, one form can handle one post/user at the same time, in your case, you might consider custom shortcode, for example, when user submits the registration form, use action hook cred_save_post to trigger a PHP function, in this function, create the new profile post.
More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://developer.wordpress.org/reference/functions/wp_insert_post/
Thank you for answering my second question. I suddenly realized this may be taking too much of my time to implement and it will be out of scope. I will discuss with my client for alternative solution. But thank you anyway for your help so far!