• After much toiling (hard work) i have worked out that

    wp_gdsr_rating_multi(1,$post->ID);

    will return the results record from the DB that i need to build my rating badge.

    What i can’t work out is how to get the value of 1 field from the above function.

    can someone advise

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, this is basic PHP. Function returns object, and you can access each property. Use print_r to preview the object and see properties.

    Thread Starter iperez_genius

    (@iperez_genius)

    I have tried many things…

    echo $post->ID; //to prove that the id is actually 20
    $test =  wp_gdsr_rating_multi(1,$post->ID);
    var_dump(wp_gdsr_rating_multi(1,20));
    print_r(wp_gdsr_rating_multi(1,20));
    print_r(wp_gdsr_rating_multi(1,$post->ID));
    print_r($test);
    
    $test2 =  wp_gdsr_rating_multi(1,0);
    print_r(wp_gdsr_rating_multi(1,0));
    var_dump(wp_gdsr_rating_multi(1,0));
    print_r($test2);

    none of these lines print anything except for var_dump(wp_gdsr_rating_multi(1,20)); and var_dump(wp_gdsr_rating_multi(1,0)); which print NULL.

    i imagine either there is something wrong with my code or i am not using the function properly…

    anyone

    Ilan

    Than, your call is not valid. Either you don’t have multi set with id 0, or there is no post with id 20, or there is no data recorded for this post for this set. This function works just fine, and I use it often, and it’s used on TVScape.NET website among others.

    GD is unfortunately full of sloppy bugs

    look!!!:
    there is in data.php:

    function wp_gdsr_rating_multi($multi_set_id = 0, $post_id = 0) {
        if ($post_id == 0) {
            global $post;
            $post_id = $post->ID;
        }
    
        $multi_set_id = $multi_set_id == 0 ? gdsr_get_multi_set($post_id) : $multi_set_id;
        $multis_data = GDSRDBMulti::get_multi_rating_data($set_id, $post_id);
        if (count($multis_data) == 0) return null;
        return new GDSRArticleMultiRating($multis_data, $set_id);
    }

    do u see it ?
    wrong var name $set_id and should be $multi_set_id !!!!!!

    Thanks for reporting this. Fix in the next release.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Rating Badge – GD Star’ is closed to new replies.