• We use your plugin for providing our online help.
    Unfortunately, we discovered recently, that the rating widget sorts posts in the top-list, which have more negative than positive votes. (Let’s say Number 1 in top posts has 465 positive and 622 negative votes)
    In this case, We suggest our usership,that this post is voted as “useful” which it actually is not ??

    Can you please add the “type” attribute value “summedUp” to sort the top posts by “positive votings – negative votings”?

    Thanks in advance
    Cheers
    Marcel

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ricard Torres

    (@quicoto)

    Hello,

    I’m not sure how we could do that.

    The plugin uses the WP_QUERY order and orderby parameters

    Check the source: https://plugins.svn.www.ads-software.com/thumbs-rating/tags/3.3/thumbs-rating.php (look for /* Top Votes Shortcode [thumbs_rating_top] */)

    Documentation for WP_QUERY parameters: https://codex.www.ads-software.com/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    Ideas?

    Thread Starter maschneider

    (@maschneider)

    Alright,

    so yeah. We figured out a quite simple solution for your problem.
    Just add another postmeta customfield for the sum of both ratings.
    So you can easily sort on this calculation ??

    PS:
    This new custom field has to be warmed up for each post, when your plugin will be installed off updated.

    Plugin Author Ricard Torres

    (@quicoto)

    I think this customisation seems very specific for your case. Never had this request before.

    Perhaps it would be best to fork the plugin rather than adding this. Which doesn’t seem light (recursive post updates, etc)

    Thread Starter maschneider

    (@maschneider)

    Hello Ricard,

    we do understand your position.
    But on the other hand, after overthinking, it is more a bug than a feature request.

    In fact, you can’t really say that this is a correct sorting of best rated posts:
    1. Post A (600 pos / 4000 neg)
    2. Post B (400 pos / 100 neg)
    3. Post C (150 pos / 160 neg)

    ??

    I am going to be using this plugin to determine what plugins we will next develop in our own open source project and I have to agree with the author of this post, and I am surprised it hasn’t been requested more.

    A proper sorting algorithm should take the number of positives, subtract the number of negatives, and then sort all posts based on the final number.

    Thats what I would like to do. So allow me to share some examples:

    5 positives / 0 negatives = (5 – 0) = 5
    3 positives / 2 negatives = (3 – 2) = 1
    3 positives / 3 negatives = (3 – 3) = 0
    2 positives / 4 negatives = (2 – 4) = -2

    And these short be how they are sorted.

    Looking at the code (I am NOT good with wordpress at ALL) I am thinking something like…

    function thumbs_rating_sortable_columns( $columns )
      {
      $columns['thumbs_rating_up_count_orig'] = 'thumbs_rating_up_count';
      $columns['thumbs_rating_down_count_orig'] = 'thumbs_rating_down_count';
      $columns['thumbs_rating_up_count'] = ($columns['thumbs_rating_up_count_orig'] - $columns['thumbs_rating_down_count_orig']);
      $columns['thumbs_rating_down_count'] = ($columns['thumbs_rating_up_count_orig'] - $columns['thumbs_rating_down_count_orig']);
      return $columns;
      }

    I “believe” this should allow sorting from greatest to least at all times. Does this look correct?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Feature request: Type “summedUp” for rating widget’ is closed to new replies.