Skip Navigation

[Resolved] Db structure suggestion

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by nicolaS-3 6 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#605125

I'd like to create a db where anonymous user A invites another anonymous user B for dating. If B accepts the invitation he can see the profile of user A. The WP user table already exists and I thought to create a Many-to-Many Relationship with itself but I am not sure it can work. Your M-to-M user guide describes post relationship, not user relationships. Any suggestion about how to structure the db with Types? I am open to any solution.
Thank you.

#605334

Hi,

As you can see, the Toolset many-to-many relationship works only for two post types, it does not work for wordpress users.

But I think there is a workaround for your case, for example:
1) you can setup a custom post type "Invitation", with two custom fields:
a) Numeric field (inviting user ID)
b) checkbox field(Accept)

2) Create a view to list all wordpress users, when click the link, pass the user's ID as an URL parameter "inviting-user-id" to the target page

3) In the target page, create a CRED form with field (inviting user ID) for creating "Invitation" post, the value of field "inviting user ID" is preset by URL parameter "inviting-user-id":
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
value: Preset value

4) Create another page "My invitations", in this page, create a view list "Invitation" posts, filter by the field (inviting user ID) equal to current user's ID:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#source-for-compare-value
Shortcode attribute: The value for the filter comes from an attribute in the View shortcode
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-current-user
This shortcode outputs the information about the current, logged-in user.

And display a CRED form edit link of below CRED form:
https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/

5) Create a CRED form for editing "Invitation" post, with checkbox field(Accept), user can accept the invitation.

6) Create a page "Accepted invitations", in this page, create a view, list "Invitation" posts, filter by post author is current user, and field(Accept) is enabled, so users will be able to see all "Accepted invitations"
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/

For your reference.

#605451

Hi Luo Yang
thank you very much for the above indications, this was exactly what I was liikong for to start the project. I will go through every step carefully and let you know. Kind regards
Nicola

The forum ‘Types Community Support’ is closed to new topics and replies.