• Resolved fashioncoree

    (@fashioncoree)


    Dear, Ricard!

    First of all, thank you for this amazing plugin, I’ve tweaked it a little to fit my needs and it’s very easy to use.

    I’ve been wondering about one thing, I came across the support ticket HERE and figured that a modal would be awesome on down vote.
    The implementation of the modal is easy, though I was wondering how would you do to make the modal only appear if the user have not voted yet?
    I’ve been looking into the code, but I’m quite new at this and hoped you could push me in the right direction.

    Best Regards

    https://wordpress.org/plugins/thumbs-rating/

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

    (@quicoto)

    Hello,

    Check out the JavaScript: https://plugins.svn.wordpress.org/thumbs-rating/tags/3.0/js/general.js

    if (!localStorage.getItem(itemName)){

    This line checks if the user has nothing in his storage. That means he has not voted.

    Cheers.

    Thread Starter fashioncoree

    (@fashioncoree)

    Thank you, Ricard!

    I figured it out, might not be as clean as it should be but it works :

    if( type == 1){ thumbs_rating_class = ".thumbs-rating-up"; }
    			else{ thumbs_rating_class = ".thumbs-rating-down"; $('#improve').modal('show'); }
    
    			jQuery(new_container +  thumbs_rating_class ).addClass('thumbs-rating-voted');
    			jQuery('#thumbs-rating-' + ID + ' .thumbs-rating-thankyou').fadeIn().css('display', 'block').fadeOut(4000);

    Also added a thank you! message for convenience.
    I did rate your plugin and leave a comment, thanks again!
    Best Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if not already voted open modal’ is closed to new replies.