Skip Navigation

[Resolved] How to Link User To Event To Event Results…

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

Problem: I would like to know how to link a User and a post using Toolset.

Solution: Since Toolset's post relationships only work between posts, you can use a proxy post type to represent Users. For example, a post type called "Players". Each User will be the author of one Player post. Then you can use post relationships to link Players and other post types.

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

This support ticket is created 5 years 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 2 replies, has 2 voices.

Last updated by GeneP3364 5 years ago.

Assisted by: Christian Cox.

Author
Posts
#1511763

Tell us what you are trying to do?
I am working on a gaming event website. I would like to have two classes of users: Players and Employees. The Employee can create an Event and the Player can then RSVP for that Event. Following the conclusion of each Event, the Employees need to report the Results (outcome) which will update the lifetime stats of each participating Player. The main data points to manage are the date and location of the event, the amount of players who attended the event, the top 5 place winners of the event and then the individual scores of each player.

My thinking was to start with three separate CPT's: one for Events, one for RSVPs and one for Results (of the event), giving the Event and RSVP a relationship while also giving the Event and Results a relationship. This should give the Player the ability to create an RSVP that is related to an Event, and give the Employee the ability create a single Event and allow them to assign individual player stats to a Results CPT that would be related to an existing event.

To start:
Employee-1 Creates Event-A...
Player-1 Creates RSVP-A which is related to Event-A...

Following the event conclusion of Event-A:
Ability for Players to RSVP Event-A ends...
Employee-1 Creates Results-A which is related to Event-A and assigned to Player-1...
Employee-1 repeats this for all players.
Player-1 would then visit the site following the conclusion of Event-A and Read All Player Results (A thru Z) on the Event page and their updated stats on Player-1 Profile page.

Immediately I found one major flaw... the only way to assign a Player to Results was to use Author, but this won't work for the permissions I want a Player to have. Players should only be able to read events, RSVP events, and read the results: nothing more. Thus, I can't give them authorship access to the Results CPT.

If we could, I would like to start with solving the problem of how to assign a Results post to a Player, without using Author. It's important to keep in mind the Employees will be very limited on what they will be able to do with the site, and we are trying to keep things easy. So while I can build what I need to with USER ID's, it would be best if employees could choose by name.

I'm very open to trying anything different from how I envision thing, so long as my goal is met.

Is there any documentation that you are following?
https://toolset.com/forums/topic/attaching-existing-site-users-to-custom-posts-types/
This didn't elaborate nearly enough, but I think it's on the right track.

Is there a similar example that we can see?
I do, but I would like to share it privately.

What is the link to your site?
I would like to share it privately.

#1511903

Hi, since Toolset's post relationships system is meant to connect posts (not Users), the best way to accomplish something like this is to use a proxy post type. Something like "Member", for example, to represent Users. Each User is the author of one Member post, so then you can use post relationships to link Members with other custom post types. Then you can access the post author of a related Member post anytime to display User information. If you want to allow custom searches for Users, you should place the search criteria in the Member post using custom fields. This will allow you to create custom searches based on that criteria, which is not searchable if added directly to User profiles.

We have some documentation about this technique available here: https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
Check the FAQ section for information about how you can use a View to limit each User to creating only one Member post.

Let me know if you have questions about this approach or if I've misunderstood what you want to accomplish, and I can offer more feedback. I have also activated private reply fields so you can share login credentials confidentially if you'd like. Also note that any URL you share in a forum post or reply is automatically obscured from other Users. Only you and other support team members can see it.

#1515823

Perfect advice. I have a lot of work to do, including setting up the registration so that it creates the post immediately following, but I think I know how to do that. I will post another issue separately about RSVP's... For Now, my issue is resolved. Thank you!