Skip Navigation

[Resolved] In custom post type, relate author with role created

This support ticket is created 3 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 3 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#2131515

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"

#2131737

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/