WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery Voting
[resolved] Show results even after disabling the voting (5 posts)

  1. Anonity
    Member
    Posted 1 year ago #

    Hey again,

    Could it be possible to show to total amount of votes that each image received even after I disable the voting for the images in that gallery?

    It doesn't matter if "Allow users to see results" is enabled, the moment it turn off voting, the results dissapear on the gallery (they are still on the CMS though, but I would like people to be able to see the results after the voting finished too.

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

  2. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    This is sort-of possible. We can get the voting results, and show them, but in a text based style. So if you are using star rating for example, it won't show the stars highlighted to the current results like if you have voting enabled.
    What rating type are you using?

  3. Anonity
    Member
    Posted 1 year ago #

    Just "Likes", I guess it has to be kind of easy to implement since what I want to show is the same that is showed when someone votes: "XX likes"... It's just that after I disable the voting for the images in that gallery, the results are not shown, so yeah, that's it.

    No stars and nothing else, just the same counter shown when it's enabled.

  4. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    I will hack something up a bit later today, and post it here

  5. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, so I altered the code from the previous thread highlighting the top image.
    Change the section at the top to this:

    <?php
    global $officalNggVoting;
    $topVotedScore = 0; $votingResults = array();
    foreach ((array)$images as $image) {
    	$votingResults[$image->pid] = $officalNggVoting->getImageVotingResults($image->pid, array('avg'=>true, 'likes'=>true));
    	if($votingResults[$image->pid]['avg'] > $topVotedScore) {
    		$topVotedScore = $votingResults[$image->pid]['avg'];
    	}
    }
    ?>

    Then, where you would have the voting tag when voting is enabled, put this instead:
    <?php echo $votingResults[$image->pid]['likes'].' '.($votingResults[$image->pid]['likes'] == 1 ? 'Like' : 'Likes') ?>

    That should do it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic