How to hide poll result from guest?

Andy To

Member
Is there any template modification/add on that will hide poll from guest? Instead of the result, I will like it show the voting options.

I tried to take a look at the templates for some clue, but didn't get far. I am not sure how <xen:raw $options>. Anyone has look at the template and care to explain that to me?
 
Edit the thread_view template to add a conditional like so:
Code:
<xen:if is="{$visitor.user_id}">
<xen:if is="{$poll}">
    <xen:include template="poll_block">
        <xen:set var="$options">
            <xen:if is="{$poll.canVote}">
                <xen:include template="poll_block_vote" />
            <xen:else />
                <xen:include template="poll_block_result" />
            </xen:if>
        </xen:set>
    </xen:include>
</xen:if>
</xen:if>

Oh wait, I've just realised that you want to hide the results and allow voting.

Guests can't vote on polls.
 
Edit the thread_view template to add a conditional like so:
Code:
<xen:if is="{$visitor.user_id}">
<xen:if is="{$poll}">
    <xen:include template="poll_block">
        <xen:set var="$options">
            <xen:if is="{$poll.canVote}">
                <xen:include template="poll_block_vote" />
            <xen:else />
                <xen:include template="poll_block_result" />
            </xen:if>
        </xen:set>
    </xen:include>
</xen:if>
</xen:if>

Oh wait, I've just realised that you want to hide the results and allow voting.

Guests can't vote on polls.

Thanks, I actually do not want guest to vote, but are shown the options for voting. Anyhow, thanks for pointing me at the correct direction I managed to find what I am looking for. I will show the vote block to guest but disable the input and that works out great, with some minor changes.
 
Top Bottom