Skip Navigation

[Resolved] Building a relational database – instructions?

This support ticket is created 3 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.

Our next available supporter will start replying to tickets in about 8.26 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by johnG-13 3 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#2024509

We currently have a database of users interested in a particular activity. It contains their name and other information about them. I'd like to start a second database in which we can track the activity of each user. It would have the user's name, the activity they participated in and the date they participated.

We would be able to search the second database to determine which users participated in which activities during a certain time period.

Can this be done with toolset?

#2024943

Hello and thank you for contacting the Toolset support.

Assuming that the users will interact with the system, and will have a user/password to log in to the system, you can create two custom post types and a one-to-many relationship between them:
- Activity post type: This will represent the different activities. A post per activity.
- Participation post type: This sill represent a user's participation in an activity. It will contain the date of the user's participation in custom fields. Maybe one custom field(participation date/time), or two(participation start and end date/times). Each user will be the author of their own participation's post.
- One-to-many relationships: An activity can have multiple participations.
Read more about relationships here https://toolset.com/related-lesson/post-relationships/

For the search page, you can create a view that will filter participation posts, and you can add search filters to check if a participation post is between two dates.
Read more about building search views here https://toolset.com/related-lesson/custom-search/
And about Date query filters here:
- https://toolset.com/documentation/user-guides/views/filtering-views-query-by-date/
- https://toolset.com/documentation/user-guides/views/date-filters/

If the users will not have a user entry in the system, so, they can't be authors of posts, then, we'll need to represent the users using a 3rd custom post type(Members), and we can link them to the participation post using a One-to-many relationship, where each Member can have multiple relationships.

I hope this makes sense and gives you some insights. Let me know if you have any questions or if you want to add any details.

Side note: I believe the following articles are worth to mention:
- https://toolset.com/documentation/programmer-reference/how-to-import-a-database-into-wordpress/
- https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/

#2027375

My issue is resolved now. Thank you!