Hi,
I'm trying to relate author in a custom post type.
I've a Custom Type Contacts with this elements:
Contact A
Contact B
Contact C
User WordPress:
Administrador
User A
User B
User A and User B have the profile, Comercial (I've created this role/profile)
I need this:
The users with this role/profile, only can access a list Contacts, and they can only see the contacts asigned.
Example
Contact A and Contact C is assigned to User A (And User A can only see these users)
Contact B is assigned to User B (And User B can only see this users)
How I can do it?
If I enable the checkbox "Author" in the panel edit custom pos type, I see the select, but not show the users with the role "Comercial"
Hello, post author is one way to connect Users and posts. Another option is to use a proxy post type for Users, then use post relationships with the proxy post type. This approach is described in the documentation here:
https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
This works when your Users only see lists of Contacts on the front-end of the site. You can use post relationships to filter those lists.
If I enable the checkbox "Author" in the panel edit custom pos type, I see the select, but not show the users with the role "Comercial"
WordPress determines which Users appear in the author select field based on User role. Toolset does not have much control over those options, but it is possible to use custom code to adjust the options to display other User roles. There are different solutions depending on whether you are changing the post author in the Block Editor, the classic post editor, or using the Quick Edit feature in the post dashboard list.
Classic editor and Quick Edit feature:
https://toolset.com/forums/topic/cant-add-new-user-with-new-custom-role-as-author/
Block editor (custom code from a third-party, not supported here in the forum): https://www.davidmillington.net/2020/02/25/wordpress-authors-dropdown-custom-roles/