Skip Navigation

[Resolved] Many to Many Post Relationship with Users

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to create a Many to Many relationship with users and posts.

Solution:

Unfortunately you are not able to relate a user and posts in this way and you will need to create a Profile for the user in a CPT.

Take a look at the link below.
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#support-for-users-in-toolset-and-wordpress

This should be able to assist you with setting up the user profile.

This support ticket is created 5 years, 7 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by gabrielB 5 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1231571

Hi, I've got a similar issue as this (https://toolset.com/forums/topic/post-relationship-with-users-as-children/#post-1231544) and I'm trying this workaround out.

I need to set up a many-to many relationship between a CPT (courses) and a Custom User Role (customer). I set up a CPT (customer) as you suggested in the link, but when I created my first Customer (under the Customer CPT) I didn't find any of my Custom Users in the Authors' list. Is this a permissions issue within Access?

#1231760

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Grabriel,

Thank you for getting in touch.

From what you say here " didn't find any of my Custom Users in the Authors' list." I gather that your user's are not the ones creating their Customer profile correct?

The customer profiles are being created by the admin?

Could you confirm this for me.

Thanks,
Shane

#1232034

Exactly. The admin creates the user profile and the Custom Post (customer) and also sets the custom post author.

#1232304

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Gabriel,

Unfortunately it depends on the level of the user role for the customer to show up under the author.

I think it would be best to have a simple user creation with just their username and password, then redirect them after the user has been created to then fill out their profile information.

This will ensure that the user is assigned as the author of that profile.

Thanks,
Shane

#1232654

Hi Shane,

Thanks for your help so far, but I'm not sure I understand. Maybe I didn't explain myself correctly the first time round.

I want:

  • an admin to manually create users (customers). What I didn't mention was that I am also going to have instructors as well. I thought i could tackle that the same way I did for the customers.
  • those users (both customers and instructors) somehow need to have a relationship with a CPT (courses).
  • I want to have a 'profile' page for the users, where they can see the courses they have a relationship with.

If I need to create a CPT for the users, please explain how I can tie it together with the Custom User.

Thanks,

Gabriel

#1232857

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Gabriel,

Here is a little explanation of what i'm referring to.
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/#support-for-users-in-toolset-and-wordpress

This is a different scenario but the principle is the same because you want the user to have a profile that is relatable to another CPT.

So what i'm talking about is instead of you having to manually create the Customer CPT profile based on the User Profiles. When a user signs up as a customer, you can redirect then to a Create Profile form which will allow them to add the additional information for their Customer CPT. This will automatically set them as the author of their own profiles.

From here you can relate the customer profile to the courses.

Let me know if this is a little clearer for you.

Thanks,
Shane

#1233779

Perfect! I just set it up and it works like a charm, thanks Shane.

#1233793

My issue is resolved now. Thank you!