Okay
  Public Ticket #3504495
average review score
Closed

Comments

  •  12
    MeesterGijs started the conversation

    Hi Alex,

    I would like to know what the average review score is for my courses? I have over 200 replies, they have given me stars. I want to easily know what their average score is so I can use it as PR.

    Thanks for helping.

    Gijs

  • [deleted] replied

    hi this is your average rating of a course : 

    7062513686.png


  •  12
    MeesterGijs replied

    And is it possible to easily see what the average is of ALL COURSES combined?

  • [deleted] replied

    use this shortcode : [all_review_average]

    add this code in your wplms-customizer.php file in wplms customizer plugin : 

    add_shortcode('all_review_average',function($atts,$content=null){
        global $wpdb;
        return $wpdb->get_var("SELECT SUM(meta_value) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'");
    });
  •  12
    MeesterGijs replied

    When adding that code. This is the number I get when using the shortcode:  189.70000000000002

    Is this correct? And how to interpret this?

  • [deleted] replied

    sorry for the wrong code , its the sum actually to have average : 

    add_shortcode('all_review_average',function($atts,$content=null){
        global $wpdb;
        return $wpdb->get_var("SELECT ROUND(AVG(meta_value),2) FROM {$wpdb->postmeta} WHERE meta_key='average_rating'");
    });


  •  12
    MeesterGijs replied

    worked! I have a 3.96. Thanks!