Skip Navigation

[Resolved] Make relationships between users and posts

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

Problem:
Types supports post relationships to connect different posts with each other, and the client would like to be able to include users in relationships.

Solution:
That is currently not possible but will be added in an update to Types 3.0.

40% of people find this useful.

This support ticket is created 6 years, 4 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 15 replies, has 5 voices.

Last updated by Nigel 3 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#596144

I have to build a site in which I need following functionality

1) Admin adds users with role "students". students will be assign to multiple classes(CPT).students do login and see the classes assigned to them.

2) Admin adds users with role "trainers". trainers will be assign to multiple courses(CPT).trainers do login and see the courses assigned to them.

• A student (from now user) is in a classroom.
• A classroom contains courses.
• A course is a set of lessons that need to be followed in a chronological order.
• A lesson consist of chapters with information.
• Homework can be uploaded to a chapter.
• A trainer is responsible for a course.
• Classroom, course and lessons are custom post types.
• The following users roles are defined:
• Users can be assigned to classrooms
• Trainers can be assigned to courses
• Admin can add all content.

Now, using new many to many post relationship would it be possible to achieve above goal?
I referred this link : https://toolset.com/2017/12/types-and-views-betas-with-many-to-many-relationships

Thanks

#596176

Hi Nigel,

I was reading the above and i realized that my question is slightly different, so let me rephrase 🙂

For a new project we are working on we are looking for a solution and maybe you can give us some directions in how to set it up.

The project is an online learning platform. There are two types of users (apart from the admin), students and trainers that can login to this platform.

Students are part of on or more classrooms (admin assigns them to classrooms). In a classroom the student sees a set of courses and can enroll for these courses. After they enrolled they can read chapters in lessons that are available in these courses (so classroom > course > lesson > chapter). Their progress is tracked during this and in some classes they need to upload homework that is available on a later moment for themselves and the trainer.

Trainers are assigned to courses (in multiple classrooms) and need to be able to see the uploaded documents.

Our main problem is in how to set up the relationship between the student user and multiple classrooms. We know we can’t connect users to multiple cpts directly using Toolset. Would it be best to create an intermediate post type and connect it to the user using author dropdown and work with that post type? Or is there a better way? It's not a problem when it comes to some custom coding; we mainly need some direction.

Hope you can help us, thanks a lot.

Marc

#596317

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Marc

You are right that users cannot be connected to posts using post relationships, the normal way to connect a user to a post is for the user to be the author of the post. Or you can set up some custom management where you add a custom post field that records the connected users (or a custom user field that records the connected posts).

The normal solution in this case is to create a User Profile custom post type, making the user the author of the corresponding post, and then use this post type in the post relationships you describe.

So, start there, and then expand on your post relationships as required.

Are you trying the beta for this? I'm only just getting to play with it myself, but I think it should help setting up and managing your relationships.

#596582

Are you trying the beta for this? I'm only just getting to play with it myself, but I think it should help setting up and managing your relationships.

Ans : Yes, I am trying beta plugins.Please let me know if you find anything using author.

#596651

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I've nothing to add about the author, to create relationships you will need to make a post type for your users as described above.

I think the intention is to expand on post relationships to bring users into the mix, but I expect it will be quite some time before that happens, there is still quite a bit of work involved in getting everything working for post relationships themselves. Later iterations will add the ability to filter by fields on a parent, for example, which is not currently possible.

#596657

If I go with the solution gave on one of the answer
you can set up some custom management where you add a custom post field that records the connected users (or a custom user field that records the connected posts).
Would it be possible to get data using post relationship?

#596664

When beta with user post relationship will release..Approx time?

#596740

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Marc

Where I said you could set up some custom management, that was describing a scenario where you would handle all of the relationships yourself. You would be doing that instead of using Types post relationships rather than as well as.

If you want to use Types post relationships you will need to work within its limitations, i.e. you will need to create a post for each of your users.

I can't give a timescale for adding users to post relationships, it hasn't been specified when they will start working on it, let alone finish, so we are certainly talking of a timescale of months at least.

#597696

Thanks Nigel

#624489

Any update on this in new version?

#624501

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Marc

Relationships with users is on the roadmap but not for the initial releases, which we are still working on. There are a couple of major-ish features that won't make it into the first production release—we have to have a feature cut-off somewhere—which will be the initial priority. Relationships involving users will come after that, so it is still too far away to be considered for any current or imminent project.

#1317529

Hi @nigel, I also remember requesting this a while ago. Any updates on this?

#1317659

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

@adrian it is not currently being worked on and there is still work to complete with relationships that is a higher priority that is in the development queue (self-join relationships, multiple connections of same posts, improved filters including adding more than one relationship filter to a View etc.) and so I don't expect any news about user-post relationships anytime soon.

We do have this page of documentation about how to mimic relationships between users and posts: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

#1850659

Any updates on this?

#1909405

+1

What is the status of adding this feature to Toolset?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.