Jump to content

Recommended Posts

Posted

I'm creating a star rating system for PW. I haven't found one. I would greatly appreciate your feedback.

Star Rating

image.png.9840ff4690a347f55380b9aef96e1f8d.png

Current Features:

  • IP Checking: Prevents multiple votes from the same user.
  • Displaying Stars and Rating Form: The star ratings are displayed on the pages with shortcode.
  • Average Rating Calculation and Vote Counting: Calculates the average rating based on the votes.

Known Bug:

Currently the stars are not highlighted when a user hovers over them.

Plans:

  • Improved Styling: Enhance the visual appeal and user interface.
  • AJAX Support and Feedback: Implement AJAX functionality to allow submiting ratings without page reload. Add a feature to provide users with immediate feedback after submitting their rating
  • Structured Data Schema Support: The ratings are picked up by search engines for rich snippets, enhancing SEO and visibility.
  • Cookie Checking: To further prevent multiple votes.

Usage:

The database table star_ratings is created during the installation. When you uninstall it drops the table.

Add the following shortcode to the desired location within your template:

<!--StarRatingForm-->

StarRating.module.php

  • Like 1
Posted

Neato ? You may want to turn this into a FieldtypeMulti to let PW take care of some of the database paperwork and get selector support for free.

Posted (edited)

AJAX Voting: You can now submit ratings without refreshing the page.

Cookie Checking: It checks if a user has already voted by using cookies.

Hover Effect: A hover effect has been added. If a user has already voted, the hover effect will be disabled for them.

It needs some work b efore it’s ready for use on sites.

image.png.c42246cfe6cf1c90e807818b27187c36.png

Update: I've updated the code to store the average rating, vote count and rating sum in a separate table. Now it retrieves the data directly from this table instead of recalculating each time

StarRating.module.php

StarRating.module.php

Edited by double

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...