Skip Navigation

[Resolved] Star Rating Block type with dynamic content

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

Problem: I would like to use the Star Rating Block system as an input for a Form.

Solution: Star ratings are currently only available for display, not input purposes.

0% of people find this useful.

This support ticket is created 4 years, 11 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
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 Vane 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1408709

Hi,

I created a test local site
installing one of your reference site named:
Gyms and Trainers
to get familiar with Toolset Blocks and I gladly found it contains a Star Rating Block what I was waiting for for a long time.
I wanted to check:
1) how can this Star Rating Block can be used as form INPUT ( for user submissions; regarding the demo site: I supposed users are able to rate Gyms and Trainers via this Block and Toolset Forms
2) how is it used as a calculated numeric value OUTPUT ( like the aggregated, like average rating of all submissions for every each Gym and Trainer ),
but I sadly found that this Star Rating Block only shows static numeric values.

Can I do what I want with them?

Thank you!

#1410489

Hi, the Star Rating Block isn't available as an input right now, only as a display. If you would like to see this feature added to Toolset Forms as an input type, feel free to submit your request here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
For now, a radio input field is probably the most similar input type we offer.

Displaying an aggregated value, like the average vote, requires custom code. To some degree it depends on how you decide to set up votes. For example, you could create a custom post type Votes in a one-to-many relationship with Gyms. Then create a Form that allows users to create Vote posts for each Gym. When a Vote is created, you could use the cred_save_data hook to trigger some custom code that inspects all the related Votes and calculates the average rating. Then save that calculated value in the parent Gym post. We have documentation about the cred_save_data hook available here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

We have information about the post relationships API available here: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

#1414715

OK, thank you!