WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery Voting
[resolved] Change Like / Dislike to Like only ;) (19 posts)

  1. Wookiee
    Member
    Posted 2 years ago #

    Hey Guys. I have listed the changes i have made to the NextGen Voting plugin, in order to use the Like / Dislike option, but to REMOVE the Dislike part of it, ending up with only a LIKE option.

    I have also changed my word Like, to the word Vote instead, but i did not list those changes in here, but that is really really super easy.

    Q: Why did i want to change this?
    A: I am developing a website, where none of the other options worked for me. I simply needed the like / dislike option to be changed to like only.

    It is important to give credit to the original developer/s of this awesome plugin, don't ever take things for granted. I am NOT an expert in php, simply a jack of all trades with a tiny bit of PHP knowledge.

    Version of WordPress: 3.3.2
    Version of NextGen Voting Pluging: V1.10.1
    Files to change:
    - nextgen-gallery-voting\ngg-voting.php
    - nextgen-gallery-voting\js\gallery_options.js

    Please note!! Copy your original 2 files somewhere as a backup. I have listed the line numbers of the ORIGINAL file! So after you have made your changes, the line numbers WILL vary! Do search and replace and ignore white space to get the correct code. I can NOT help you with this! Be smart lol

    -------------------------------------------------------------------
    File to change: nextgen-gallery-voting\ngg-voting.php
    -------------------------------------------------------------------

    23 changes (if i did this correctly)

    [ 288 lines of code moderated. For more than 10 lines of code please use pastebin.com instead. Honestly, use pastebin.com instead and consider using diff. ]

    Thats it!! Hope it helps someone.

    I just want to ask if anyone reads this far, does anyone know how to add confirmation to this option. Im looking for a popup that asks the user, Are you very very very sure you want to vote (like) that image? Because once you vote (or like), you cant change your mind.

    Basically just an ajax confirmation popup or something. Thanks guys have fun and good luck!

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

  2. waruikiona
    Member
    Posted 2 years ago #

    Hey man, you code is down ┬┐Can you paste it again? please use pastebin in order to avoid the moderation. thanks

  3. Wookiee
    Member
    Posted 2 years ago #

    http://pastebin.com/n88cT6GR

    Crap lol sorry bout that. Hope it helps

  4. janmalagucute
    Member
    Posted 2 years ago #

    any sample preview?

  5. brody13
    Member
    Posted 2 years ago #

    Need help. Not only did your code NOT work, it wiped out all current votes. Changed everything exactly how you instructed.

  6. Wookiee
    Member
    Posted 2 years ago #

    It's impossible for the code changes to wipe your current votes. The code changes has nothing to do with the current votes already stored in the database.

    The output is changed however, so it will "not show" any dislikes that has already been "voted", but the votes are still in your database. This simply removes the button (dislikes) and leaves you with only 1 button to click.

    DEMO HERE: http://www.myboksquad.co.cc/voting-for-loose-head-prop/

    I will list the changes again, but I have made extra changes which I will explain in detail:

    1) nextgen-gallery-voting\ngg-voting.php

    a Removed all traces of dislike
    b Changed the word Like to Vote
    c Added css classes
    - This is to have a hover state for the button (in css)
    - The css code is added in point no 3 below

    COMPLETE FILE WITH CHANGES
    http://pastebin.com/TPRDurTh

    2) nextgen-gallery-voting\js\gallery_options.js

    a Removed the output for dislikes

    COMPLETE FILE WITH CHANGES
    http://pastebin.com/51ayAB31

    3) The CSS
    You will need to add these CSS styles to your stylesheet:
    \nextgen-gallery\css\nggallery.css

    a Added div class="like_button" around the Vote button
    - You can set the width as you want
    - You can set the background colors to what you wish
    - You can even use images as backgrounds if you wish
    - I have used nasty colours in the code below, but its to show you what colours goes where.

    - NOTE: there is no button text as that is removed in ngg-voting.php, this is because I have used background images with the word Vote on my button images. So using the css below, will only result in blank but working buttons. To enter words in your buttons instead of having background images, read point 4 below.

    .like_button a:link, .like_button a:visited
    	{
    	width:90px;
    	height:30px;
    	line-height:30px;
    	background-color:#FF0000;
    	border: 0px solid #33FF00;
    	display:block;
    	}
    .like_button a:hover, .like_button a:active
    	{
    	width:90px;
    	height:30px;
    	line-height:30px;
    	background-color:#3333CC;
    	border: 0px solid #FF6633;
    	display:block;
    	}

    d Added span class="like-results-text" around the word Vote/Votes
    - Because I want the results (amount of votes) to look different from the word Vote or Votes

    .like-results-text
    	{
    	color:#a4a4a4;
    	}

    4) Adding text to button.

    To have ANY word appear on the buttons instead of going out to create background images with the word on the images itself

    In file ngg-voting.php (TWO changes)

    Find:
    $out .= '<div class="like_button"><a href="'.$url.'gid='.$gid.'&r=1" class="nggv-link-like">&nbsp;</a></div>';

    Change to:
    $out .= '<div class="like_button"><a href="'.$url.'gid='.$gid.'&r=1" class="nggv-link-like">MY TEXT</a></div>';

    Find:
    $out .= '<div class="like_button"><a href="'.$url.'ngg-pid='.$pid.'&r=1" class="nggv-link-like">&nbsp;</a></div>';

    Change to:
    $out .= '<div class="like_button"><a href="'.$url.'ngg-pid='.$pid.'&r=1" class="nggv-link-like">MY TEXT</a></div>';

    That should be it. Let me know how it goes. I have NOT tested the output (the look & feel) of voting for a gallery, ONLY voting for images.

    I'm not 100% sure, but Shauno (the original developer of this plugin) Should have the Like only option available in a next release. so up to you if you think this is too much work, but it works perfectly for me.

  7. Wookiee
    Member
    Posted 2 years ago #

    Important update:

    There is an issue with the javascript file above in step 2.
    2) nextgen-gallery-voting\js\gallery_options.js

    I have made a mistake, I'm sorry >.<

    Whats wrong?
    - Gallery Voting options disappeared when you view/manage a gallery

    Fix:
    Either make the fix manually like this:

    Line 123
    Change this:
    html += '<td>'+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike d>';

    To This:
    html += '<td>'+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike')+'</td>';

    Or
    Copy the whole code over from here:
    Complete file:http://pastebin.com/n4D6mZNA

  8. Rico77
    Member
    Posted 1 year ago #

    Hi, thanks for this nice Hack! The only thing, which doesn't work, are the styles for the buttons below the gallerypic. I updated the star_rating.css , which is the only original .css in these plugin files with your codes mentioned above. It seems that the div class="like_button" and the span class="like-results-text" couldn't pull out the stylesheets somehow...

    Now its looking like this: http://www.hunde-fan.de/bilderalbum/

    Can you help me?

    Regards Rico

  9. Wookiee
    Member
    Posted 1 year ago #

    Hey Rico

    I'm doing this off my mind at the moment, so hopefully it will work.

    You should put the style code in the nextgen plugin stylesheet, not the voting stylesheet.

    Yours should go here:

    /plugins/nextgen-gallery/css/nggallery.css

    OR HERE but try the first mentioned above first

    /wp-content/themes/mydog/style.css (this is your template stylesheet)

    Hope it works.

  10. Rico77
    Member
    Posted 1 year ago #

    Hi Wookie, thx a million! Now it works. Was my mistake. You made may day! :-)

  11. Wookiee
    Member
    Posted 1 year ago #

    No worries..glad it worked

    Always remember, you can see which stylesheets are loaded in any page by just viewing the source. Right click > view source in your browser, then just search and find ".css"

    That way you can be sure on any given page which stylesheets are being loaded.

    If something doesnt work once you have made changes to your stylesheet, just check if the stylesheet is actually loaded.

    I only put the source code in the gallery stylesheet because if I ever decide to uninstall the plugin, i dont sit with unwanted code in my MAIN template code... if that makes sense, but any stylesheet that is loaded in ur page would make it work.

  12. Rico77
    Member
    Posted 1 year ago #

    Thx for your advice!

  13. rjsiebert
    Member
    Posted 1 year ago #

    Why not just add

    .nggv-link-dislike {
    display: none;}

    to a child style sheet?

  14. Chornyterrier
    Member
    Posted 1 year ago #

    Rjsiebert
    would you be able to help me and take me step-by step where to change the disklie? Thank you...
    Sorry to bother you... just very bad with wordpress....

  15. rjsiebert
    Member
    Posted 1 year ago #

    Do you update your theme often? (If so I would recommend setting up a child theme: http://codex.wordpress.org/Child_Themes)

    Otherwise in the WP Dashboard go to Appearance > Editor. On the right it should say that your are in the style.css

    Scroll to the bottom of the text in the box and add:
    .nggv-link-dislike {
    display: none;}

    This should do it for you.

  16. gvikramjee
    Member
    Posted 1 year ago #

    rjsiebert :

    Adding The Following block of code removes the Dislike button.

    .nggv-link-dislike {
    display: none;}

    Once the user clicks on the Like button, It shows a summary below the image
    '1 Like 0 Dislikes', Please can you advise how I can edit this message.

  17. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Hi all

    I have just released a new add-on to NGG Voting that adds the plain 'like' voting type (amongst other things). It will also allow you to edit the messages displayed to your users, and change the voting image easily.

    Check it out here: http://codecanyon.net/item/nextgen-gallery-voting-premium/3307807

    Let me know if you have any questions!

  18. capotea
    Member
    Posted 1 year ago #

    Hi Shauno,
    Thanks for this premium version of the plugin. It's worth the money for me.
    And it saves a lot of time and puzzling editing the original plugin.
    I'm going to purchase it.

  19. shauno
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Fokkio
    I'm glad the premium version can help you! Let me know if you have any issues or feature requests, and I will see what I can do.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.