• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Improving Post Ratings

This entry is part of a series of entries "January 2017 - XenWord Development Log"
Post Ratings.png


The Post Ratings addon by Luke is an essential XenForo addon. Basic XenWord support for the addon was included in April 2015, release 2.5.0 ( number 78 ) and the last changes were made in March 2016.

Since support has been limited to showing likes on the WordPress side then I've been trying to figure out how to expand features. The image above shows that work has progressed.

The challenge was pulling the information from the provided methods. I decided this morning to build my own array, count the values, and use the key in a switch statement to choose what is shown.

PHP:
$combinedRatings = array();
foreach ( $ratings as $rating ) {
   array_push( $combinedRatings, $rating['rating'] );
}

$combinedRatingsTotals = array_count_values( $combinedRatings );

I thought this was a clever way to pull the information for each first post in a thread. All of the cases in the switch statement are not complete and I hope to get things done today.

Update: All done and online to test.

Post Ratings Completed.png
  • Like
Reactions: Goodfella and robru

Latest reviews

Adding the full range of post ratings to WordPress is exactly what was needed. I missed being able to "agree" and have it not show on the WordPress side.

Two major thoughts: Can you figure out how to let us add the rating on the WordPress side and have it show? Can you figure out how to let the comment ratings sync, too?
  • Like
Reactions: robru

Blog entry information

Author
LPH
Views
2,499
Comments
3
Reviews
1
Last update
Rating
5.00 star(s) 1 ratings

More entries in Technology

More entries from LPH

Top