[Resolved] Many to many between custom post type and user

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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation: WordPress Custom Post Types

This topic contains 12 replies, has 2 voices, and was last updated by  romanB-3 1 month, 2 weeks ago. The support staff assigned to this topic is Noman.

Viewing 13 posts - 1 through 13 (of 13 total)
Author
Posts
#549474

hello,

I am trying to set up a many to many relationship between a custom post type and the WP users.

I have the CPT "Projects" and the default wordpress Users post type :
- Each Project should has at least one Project Coordinator (which is a User) ;
- Each User may be Project Coordinator for various Projects.

How may I set this up ?
Thank you.

#549577

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hi Roman,

Thank you for getting in touch with us. Using Toolset you cannot create relationships between Custom Post Type and Users. But I think there will be a workaround that can help in your case:

1. Each Project should has at least one Project Coordinator (which is a User) ;
==> For this you may use plugin like “Co-Authors Plus” as this will allow you to have multiple users (project coordinators) assigned to a project: https://wordpress.org/plugins/co-authors-plus/

Please note that we do not officially guarantee on working of this 3rd party plugin, I am just sharing this as I noticed a client using it and the basic feature worked fine.

2. Each User may be Project Coordinator for various Projects.
==> This is already covered in WP native, because each user can have multiple posts (projects), rest will be manageable by above plugin.

Related tickets on same topic:
- https://wp-types.com/forums/topic/relationship-between-a-wordpress-user-and-a-post-type-not-working/#post-528377
- https://wp-types.com/forums/topic/user-relationship-with-a-custom-post-type/#post-318013

I hope the above info helps, Thank you

#551546

Please don't close this thread yet.
Thank you.

#551938

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

yes, sure. This ticket is open and you will write us back if you need any help. I would happy to help you.

Thank you

#552148

Hello and thank you for your answer,
This solution doesn't seem to fit because the "author" of the post may not be the same than the "project manager" related to it.
Thank you.

#552264

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Roman,

In that case your options are quite limited to build this setup. Using Toolset it's not possible to associate a Custom Post Type to a User Profile directly. The previous given solution in this thread might be helpful, basically this method talks about adding User Fields for each WP user:
https://wp-types.com/forums/topic/user-relationship-with-a-custom-post-type/#post-318013

I have tried to look for a workaround but could not find anything matching to your case. Its may be possible using some custom code to make it happen. We have some recommended list of service providers here who can help in such cases: https://wp-types.com/consultant/

Thank you

#552433

Thank you. I've been thinking this again and I think I'll stay with your first solution, which is using the Author field to create the relation between Projects and Users.
Now I wonder how it would be possible for a User to choose a Project Manager among existing Users while creating a new Project ?
Thank you very much.

#552456

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hi Roman,

How it would be possible for a User to choose a Project Manager among existing Users while creating a new Project?

>> You may achieve this using two user roles.
Step 1:
1. Create user role as Project Manager
2. Create user role as User

Step 2:
Create a CRED Post form and display both user roles (radio options), where user can select his role (Project Manager or User)

Thank you

#552473

Hello and thank,
That's not quite this since there are a lot of Project Managers.
While the Admin creates a new Project, he must be able to choose WHICH Project Manager will Manage this specific project among registered users.
Thank you.

#552508

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

Hello Roman,

Unfortunately this is not possible. May be you can create Custom post type for Project Manager but again you will not use any Project Manager as a user.

Thank you

#552509

So if I understand well, there is no way to choose a post's author threw a CRED form ? Wouldn't that even be possible thanks to the CRED API ?

#552717

Noman
Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Karachi (GMT+05:00)

There is no way to choose a post's author threw a CRED form?
==> No, CRED form does not have any Post Author field. Usually the person who submits the form is treated as post author. Even if we have field one post can have one author only.

So it's not possible using Toolset. Its might be possible using some custom code & API but I am not sure how. You may contact recommended Toolset service providers who can help in such cases and work with you directly on this custom approach and custom code stuff: https://wp-types.com/consultant/

Thanks

#555499

Thank you.
Found a workaround with user IDs.

Viewing 13 posts - 1 through 13 (of 13 total)

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.