Skip Navigation

[Resolved] Connecting users and post types

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.

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/Karachi (GMT+05:00)

Author
Posts
#1776725

Hi Waqar
How are you?..:-)..

I have this requirement.. I have a custom post called PERFUMERS and I have another one called FRAGRANCES

I want PERFUMER to create review for FRAGRANCES

so I will create another custom post called REVIEWS..

Now PERFUMER will have to log in and REVIEW.. so how do I connect the post PERFUMER to a wordpress user and what kind of relationships I need to create between REVIEW and PERFUMERS and REVIEW And FRAGRANCES?

#1777061

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Alim,

Thank you for waiting.

During testing on my website, I was able to make this work using only two custom post types and an intermediary post type, which gets created, as a result of "many-to-many" post-relationship between them.
( ref: https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/ )

I added two custom post types:

- Perfumers
- Fragrances

Next, I created a "many-to-many" relationship between these two post types and named the resulting intermediary post, as "Reviews".
( screenshot: hidden link )

Note: You can add any custom fields like Review Title, Review Score, etc, in this intermediary post, during the wizard.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1777111

Hi Waqar

That's really cool!!!!.. I am excited...:-)..

I know the best way is to really try it out and I will but it's already 7 pm here in Bali and I am not sure I will be able to do more research today.. so just shooting off a few queries..

  • Can this intermediary post be displayed as My Reviews in the Perfumer's Post?
  • Can this intermediary post be displayed as Review by Perfumers in the Fragrance Post?
  • I would like it to be displayed as star rating with a text review... Can I create this view and display this for the above?

Regards,
Alim

#1778355

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Alim,

Thanks for the update.

All the 3 points that you've shared are possible to achieve using this setup and you'll just need a new post view set to show this reviews intermediary post, with a post-relationship query filter, to show the current post's related entries only.
( ref: https://toolset.com/course-lesson/many-to-many-post-relationships/ )

You're welcome to try this and let me know if you have any follow-up questions.

regards,
Waqar

#1779545
Screen Shot 2020-09-17 at 11.10.34 AM.png
Screen Shot 2020-09-17 at 11.11.00 AM.png
Screen Shot 2020-09-17 at 11.11.07 AM.png

Hi Waqar

I already had a many to many relationship between the perfumer and fragrances so there was already an intermediary post called 'perfumer-fragrance'

I added 2 fields to it.. One a multiple line that's for a text review.. and another one I have used is a SELECT..

I've attached screenshots to help you understand..

I have used text values for display (good, bad, average etc) but in the custom field content I have 1,2,3,4,5 and I would want to use these values to display the toolset star rating..

I would appreciate some hand holding here as I have no clue how to proceed further.. How do I add a review?

Currently I can do it on behalf of a perfumer but later on I'd like to add a form that the perfumer can log in and fill.. but that's not for now.. for now I'd appreciate if you could first advise me if the above method is fine for toolset star rating display or if the custom field content won't work as numbers..

Secondly how to add a review and how to display it on the Perfumer's page and on fragrance page..

Another thing that's not very critical but would help is whether the name of the intermediary post can be changed to something more explanatory like 'perfumer-review' instead of 'perfumer-fragrance'

Regards,
Alim

#1779779

Hi Waqar

I was making a mistake by using the existing relationship as I didn't realise I could create another relationship as the previous one had a different requirement.

So while creating I had the option of naming the intermediary post the way I wanted and also allowed me to create a menu on the sidebar..:-).. which is pretty cool.. but I still have to see what can I see there..

I was able to add a review from the wp-admin section.. but now I need to figure out how to allow a perfumer to select a perfume and review it.

Can a perfumer be allowed to rate any perfume or do i need to do something to allow the perfumer to rate a perfume? I am assuming I need to create a form.. could you please guide me on this?

Regards,
Alim

#1779997

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Alim,

Glad that you're making progress.

To add a review from the front-end, you'll need to create a Relationship form from WP Admin -> Toolset -> Relationship Forms.
( ref: https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/ )

While editing the form's field, you'll see the fields for selecting the "Perfumer" and "Fragrance" post and also the custom fields associated with this "Reviews" intermediary post type.

An important point to note here is that you'll select "Options only by the current author" option in the "Perfumer" field, to ensure that a user can only add a review linked to his own "Perfumer" post and not for the other users.
( screenshot: hidden link )

regards,
Waqar

#1780899
Screen Shot 2020-09-18 at 11.24.10 AM.png
Screen Shot 2020-09-18 at 11.22.53 AM.png

Hi Waqar

Before creating a front-end form I wanted to create a template to display the review I had created using the backend.

So I went to the FRAGRANCE content template and added a view and I expected to see the Perfumer Review section so that I could add it but it wasn't there.. (screenshot attached)
https://toolset.com/wp-content/uploads/tmp/Screen_Shot_2020_09_18_at_11.22.53_AM.png

Just to confirm to you that it exists here's a screenshot of the relationship fields intermediary post
https://toolset.com/wp-content/uploads/tmp/Screen_Shot_2020_09_18_at_11.24.10_AM.png

I remember having seen the Intermediary post menu on the left sidebar of wordpress admin dashboard when I created it.. but it's no longer there..

What am I doing wrong? Please advise..

If you need access please send me a private message option and I'll provide you the credentials..

Regards,
Alim

#1782895

Hi Waqar

The issue resolved itself after I installed the latest Toolset Blocks and Types from the downloads folder..:-)..

So now I am able to see the assign the views to the intermediary posts.. here I've created a fragrance with 2 reviews

hidden link

The star rating seems to take only number fields and the select with with a field value in numbers was not displayed.. so I am sticking to the number field for now..:-)..

I will have a few queries on implementing this but I will close this ticket for now and create newer tickets for the future queries.. I will need some help in 2 things primarily..
1) Connecting the user to the post (PERFUMER)
2) Creating the frontend form for the perfumer to submit his review

Have a nice day...:-)..

Regards,
Alim

#1782897

My issue is resolved now. Thank you!

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