WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery Voting
[resolved] show total result for an image (9 posts)

  1. tomas.halo
    Member
    Posted 1 year ago #

    Hello,
    thank you for a great plugin. My question is: Is it possible to show score / number of total votes for every image in gallery? something like in backend: (Xnumber votes cast).

    Thank you!

    http://wordpress.org/extend/plugins/nextgen-gallery-voting/

  2. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Hi tomas
    Unfortunately there isn't anything like that in the plugin currently. You can run a query on the database yourself if you want. Something like this should do it:
    SELECT COUNT(*) AS total_votes FROM wp_nggv_votes

    That's not going to take into account images that have votes cast, and then were deleted from NGG, but it will give you the total number of votes ever cast.

  3. tomas.halo
    Member
    Posted 1 year ago #

    Hi,
    thanks for your answer, but it is not what i need, you know. In the past version of plugin was able to see results for image via function:

    $results = nggv_getImageVotingResults($image->pid, array("num"=>true));
    echo $results['number'];

    but it does't work anymore although i rewrote name of function to "getImageVotingResults".

  4. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, I thought you were after all the votes across the site.
    You can still get that info, it's just now wrapped in an object.

    $results = $officalNggVoting->getImageVotingResults($image->pid, array("num"=>true));

    That should do it :)

  5. tomas.halo
    Member
    Posted 1 year ago #

    Hi,
    thanks for that piece of code, but it doesn't work for me. do you have any idea where the problem should be?

    /*code*/
    '$results = $officalNggVoting->getImageVotingResults($image->pid, array("num"=>true));
    echo $results['number'];'

    placed after the tag with voting form.
    ---
    Thanks for your time!

  6. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    You need to declare the scope of the object. So the full code would be:

    <?php
    global $officalNggVoting;
    $results = $officalNggVoting->getImageVotingResults($image->pid, array("num"=>true));
    echo $results['number'];
    ?>
  7. tomas.halo
    Member
    Posted 1 year ago #

    Thanks a lot! Works like a charm:)

  8. Nicolas.Bas
    Member
    Posted 1 year ago #

    I've the same problem for the creation of recent blog : I wish Insert the score or number of total vote on all image. Ok, I must placed the latest code :

    <?php
    global $officalNggVoting;
    $results = $officalNggVoting->getImageVotingResults($image->pid, array("num"=>true));
    echo $results['number'];
    ?>

    in php page but I'm Just a WebDesigner ... In which page? And Where in this page?

    Sorry for my horrible english

  9. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Nicolas
    You need to add that code to the template that you added the original voting tag. If you are using the shortcode [nggallery id=x] then that file is wp-content/plugins/nextgen-gallery/views/gallery.php

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.