WordPress.org

Ready to get started?Download WordPress

Forums

PhotoContest Plugin
Disallowing voting while entries are being collected (6 posts)

  1. jannmirch
    Member
    Posted 3 years ago #

    I am helping a client set up a photo contest and this plugin was a quick and easy way to do it. The only problem was we wanted all the photos in BEFORE we opened up the voting. But we did want folks to be able to view the other entries. The plugin didn't have any native functionality so here's what we did. (You will want to be comfortable mucking around in the code.)

    Open the viewimg.php file and comment out the Vote form so that it doesn't show on the rendered page. We added a line of text to let viewers know when the voting would open up.

    Lines 665-666 now look like:

    <div class="wp-photocontest_detailstext">
    						<p>Voting begins August 1 and ends August 31. Winner will be announced September 2.</p>

    [Please post code snippets between backticks or use the code button.]

    And to hide the voting form lines 716-826 now look like:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    When ready to open up the voting, remove the comment code.

    Hope this is helpful. It's a great plugin.

  2. areaphoto
    Member
    Posted 3 years ago #

    I really suck at code but I REALLY need to do what you are describing. I'm a little confused in the way that you wrote it. I realize it's probably frustrating because I'm ignorant but I could really use your help. Thanks

  3. jannmirch
    Member
    Posted 3 years ago #

    No worries. I see that the code got removed...

    But the idea is to add a comment code to "hide" the voting from visitors. That would look like:
    <!-- [code goes here] -->

    So you see from the first post where I added a line letting visitors know what the deal is with the voting. That text is getting added in the "wp-photocontest_detailstext" div as a paragraph.

    Then, since I added a line of code, everything else gets bumped down. Now I'm looking at line 716 to add the open comment code '<!--' in front of the voting form so it looks like this:

    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" id="photocontest-vote_form">

    But now that I've added it, everything that follows is commented out, meaning the browser won't read it. So I need to close the comment which will happen on line 826 which will now look like:

    ?> -->

    When I'm ready to open up the voting, I will just take out the comment code.

    Let me know if you still have questions.

  4. frekel
    Member
    Plugin Author

    Posted 3 years ago #

    I really like you posting solutions! Thanks!

    This is a functionality I can add into the next version.

    Thanks again,
    Frank

  5. wgarnsey
    Member
    Posted 2 years ago #

    I have ended my contest (have all the photos submitted), now I want to open it to community voting. How do I do this?

  6. wgarnsey
    Member
    Posted 2 years ago #

    Disregard my last post. I figured it out. It was right in front of me, the contest end date and upload dates can be two separate dates. DOH!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic