• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

null vote if viewing vote results

optrex

Active member
#1
when a poll is running, I would like to prevent people from viewing the results before they vote. This could be done by:

Hiding the view results button until after someone has voted
Or by preventing them casting a vote if they view the results first (mulling the vote)

Is this currently possible by way of file edit or addon?
 

Jake Bunce

XenForo moderator
Staff member
#2
Admin CP -> Appearance -> Templates -> poll_block_vote

Remove the red code:

Code:
<xen:edithint template="polls.css" />
		
<div>		
	<ol class="pollOptions">
		<xen:foreach loop="$poll.responses" key="$pollResponseId" value="$response">
			<li class="pollOption"><label><xen:if is="{$poll.multiple}">
				<input type="checkbox" name="response_multiple[]" value="{$pollResponseId}" /><xen:else />
				<input type="radio" name="response" value="{$pollResponseId}" /></xen:if>
				{$response.response}</label></li>				
		</xen:foreach>
	</ol>
	
	<div class="buttons">
		<xen:if hascontent="true">
			<div class="pollNotes">
			<xen:contentcheck>
				<xen:if is="{$poll.multiple}">
					<span class="multipleNote muted">{xen:phrase multiple_votes_allowed}</span>
				</xen:if>
				<xen:if is="{$poll.public_votes}">
					<span class="publicWarning muted">{xen:phrase your_vote_will_be_publicly_visible}</span>
				</xen:if>
			</xen:contentcheck>
			</div>
		</xen:if>
			
		<input type="submit" class="button primary" value="{xen:phrase cast_your_vote}" accesskey="s" />
		<input type="button" value="{xen:phrase view_results}" class="button OverlayTrigger" data-href="{xen:link threads/poll/results, $thread}" />
		<noscript><a href="{xen:link threads/poll/results, $thread}" class="button">{xen:phrase view_results}</a></noscript>
	</div>
</div>
That will hide the results button. They can only view results by voting.