• Resolved lagdonkey

    (@lagdonkey)


    Hello again, you’ve helped me in my previous thread, but now I’ve come across 2 more questions that I can’t seem to fix.

    First off, I followed your advice in getting my form to show conditionally, however now when you click on the vote buttom, it comes up with “There’s a problem saving your vote”.

    The wierd thing is, however, that it DOES save the vote and if you refresh the page it reflects as so. Not sure why this is happening.

    Now my second problem is this: There seems to be no way to show the voting form JUST where I want it to. Ie: in gallery mode, it automatically shows at the bottom of the gallery. I want to enable voting for images/galleries, but full control over where it shows up.

    I’ve tried wrapping the vote form inside of a DIV with Display:none, but this then hides ALL instances of the form. I’ve also tried setting it up so the vote form is inside of a parent element that DOES show it, but that doesn’t work either.

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

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author shauno

    (@shauno)

    Hi lagdonkey

    The problem with the voting could be many things. The most common I see is that another plugin or script is generating javascript errors. So when the AJAX vote happens, the other JS errors break the code that interprets the response from the server, and it loads the default error.
    This sometimes also happens if you are running caching plugins. Again, they interfere with the AJAX understanding he vote response with the server.
    Is there a URL I can look at to see if I can get more info?

    I’m not sure I understand your problem displaying the voting form. The code I can you last time would only show the voting form if it is enabled for that image, and the user hadn’t voted.
    You can change which images/galleries are enabled from the ‘manage gallery’ screen in NGG.

    Thread Starter lagdonkey

    (@lagdonkey)

    Well, I AM running another JS plugin called anything slider, but the problem seems to persist even if I disable it.

    To be more clear on my issue, when displaying a gallery with your plugin enabled, and voting for Galleries (not images) is enabled, then the voting form automaically appears at the end of the gallery. However, this isn’t where I want it to appear. I want to hide the automatic gallery voting form, and have it appear where I choose to show it.

    Plugin Author shauno

    (@shauno)

    That’s a problem. If you have gallery voting enabled, the voting plugin automatically outputs the voting form. It does this for galleries because NGG provided a place to ‘hook’ into with galleries, but not with images.

    I had hoped the voting automatically showing would create less problems for me with people who wouldn’t know where to put a the code to display the voting form.

    Unfortunately, there is now way to hide the automatically generate gallery voting form, and output it in the template yourself. I will look into adding an option to stop the gallery voting form from showing automatically in a future version, but I can’t make promises about when/if that will be released.

    If you really need it, I can talk you through altering the voting plugin’s core files to get it to do what you want. This shouldn’t be hard to do, but it will get overwritten when you update.

    Thread Starter lagdonkey

    (@lagdonkey)

    Well I think it’d be as simple as somehow adding a second class. One for the auto generated form, and a second class for when the form is generated manually.

    As I said, I already tried setting display:none on the ngg-vote-form class in css, and then where I manually output the form, I tried wrapping it in a parent class. From my understanding, the ngg-vote-form SHOULD become a child class, where I can set my own css styles, which it does, but it also inherits the display:none which I can’t seem to overwrite.

    Unless I’m missing something, I’m sure this can be resolved with CSS, so I will to continue fiddling around with that. It wouldn’t be a bad idea to add manual placement options in future builds of the plugin like you said, as it would allow for more flexibility.

    Thread Starter lagdonkey

    (@lagdonkey)

    Okay, update time:

    Was able to figure out, and indeed make it work with css magic.

    Here’s the css.

    .votewrapperform .nggv-vote-form {
    display:inline;
    }

    .nggv-vote-form {
    display:none;
    }

    If I want the form to show, I simply wrap it inside a votewrapperform clss, and it inherits the display:inline, which overrides the display:none which is the standard class for ngg-vote-form.

    So I completely achieved what I want, however it’d still be great to see that option in future builds.

    Now to try and plug away at what’s causing that issue with the vote not saving message šŸ™‚

    Thread Starter lagdonkey

    (@lagdonkey)

    Spoke to soon, seems I can’t seem to call the gallery vote form where I want it to show up, like I could with the imagevote form.

    How do I go about that?

    Plugin Author shauno

    (@shauno)

    The best way to stop the form showing, would be to stop the plugin hooking into NGG’s output hook. If you try hide the form, and then add another, I’m not sure what effect that could have on the JS/AJAX stuff.

    You can just comment out line 114 (roughly, I am making changes for a new version release, so my local file may be different to the current download version) in the __construct() method. The line you need to comment out looks like this:
    add_filter('ngg_show_gallery_content', array(&$this, 'showGallery'), 10, 2);

    That should stop the plugin automatically showing the voting form.

    Thread Starter lagdonkey

    (@lagdonkey)

    Well, like I said previously, I managed to hide it via css. Since it’s wrapped in a parent element, any styles passed are over-ridden, which basically means I can hide/show it on a case by case basis, just by wrapping it in a <div> with the display:inline. Also means no editing of core files (which I’m comfortable doing, but don’t like to since updates just overwrite changes.

    My problem now however, is which function do I call to have the gallery vote form where I want. The closest I could figure is your:

    nggv_gallery_vote_form

    function, however every time I call it, it returns an error about undeclared objects. I’m assuming that you didn’t add a second hook for it, like you did with the $officalnggvoting. Unfortunately, trying to figure out how to add the hook myself goes a little beyond my PHP knowledge so I’m hoping you can put me on the right path. Don’t worry about the display side of it, as I can manage that with css(which i’m far more adept at) I just need to be able to call the function and have it return the expected output.

    Plugin Author shauno

    (@shauno)

    To show the gallery manually, you can use the following code:

    <?php
    global $officalNggVoting;
    echo $officalNggVoting->galleryVoteForm($gid);
    ?>

    I really would suggest commenting out that line I mentioned in the previous message. I realize you can hide the automated voting form with CSS, but I don’t know how the page will be affect with 2 forms actually on it. I’m not sure the JS/AJAX stuff will handle it correctly.

    Thread Starter lagdonkey

    (@lagdonkey)

    Oh, I see what you mean, that might also be what’s responsible for my “vote not saving issue”.

    I’ll try fiddling and post what I come up with. Thanks again for being so helpful, it’s really appreciated.

    Thread Starter lagdonkey

    (@lagdonkey)

    Well, I commented out the line you suggested, and after some fiddling around, managed to get the gallery vote form to do the check, and then show the form where I want.

    However, I’m still having problems where the “Vote cannot be saved” pops up, and another wierd bug has popped up. Periodically, clicking on a vote form takes the vote, and then just refreshes the page. It adds the vote, but the page refresh is really odd.

    Maybe you can look at what’s going on: http://amazinglyamusing.com/pictures/

    The only other javascript program I’m running, is anythingslider, and these bugs persist even if I disable it.

    Plugin Author shauno

    (@shauno)

    When the page loaded, there were definitely 2 vote forms. I then voted to see the problem, and it did re-load the page. That means the JS didn’t fire, but the plugin falls back to still work even without JS working.
    When the results page loads, there is only 1 form. But now that I have voted, I can’t see the page as if I hadn’t. You will need to turn on unlimited votes for me to test.

    Thread Starter lagdonkey

    (@lagdonkey)

    Okay, I’ve updated it to allow unlimited votes for testing.

    I checked my site with browsershots, and it turns out that the nggv-vote-form still shows up on many other browsers. I tried commenting out the line you suggested, heck I even took it out completely, but it still shows up regardless of whether or not I remove/comment out that line.

    It also turns out, that my css “hack” doesn’t work on all browsers, so at this point I HAVE to get it figured out šŸ™

    Plugin Author shauno

    (@shauno)

    Commenting out the line will most definitely remove the auto adding of the field.
    Find the line in ngg-voting.php that looks like this:
    add_filter('ngg_show_gallery_content', array(&$this, 'showGallery'), 10, 2);
    and change it to this:
    //add_filter('ngg_show_gallery_content', array(&$this, 'showGallery'), 10, 2);

    Thread Starter lagdonkey

    (@lagdonkey)

    Well, I have that line commented out, and yet unless I use css to hide it, it still shows up. As well, you’ll notice that if you click the first vote form (in the subheader) it counts 2 votes instead of one. My guess is, it’s because there’s a second form (hidden) and it’s firing as well as the one you click.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘A few more questions about this plugin’ is closed to new replies.