Managing vote permission

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Managing vote permission

Mencey Melgar
hi,, I want to know if there is a way to control this, for example, I create a poll and I want to show it to some groups but I only want 1 group voting, is there a way to manage this without create other permission? for example, allow the vote permission only for those who can create polls.

Thanks :)
:) Helper
Reply | Threaded
Open this post in threaded view
|

Re: Managing vote permission

Pedro
Go to poll_js macro and replace this line " if (!<n.poll_visitor_can_vote/>)  " with this "  if (!<n.visitor.can_create_poll_in.page_node/> )  ".  In this way, only those who can create polls will be able to vote.
The beginning of your macro will be like this:
 <override_macro name="poll_js" requires="servlet">
    <n.comment.>
        This is the javascript code that will update the poll controls and make them available to the users.
    </n.comment.>
    <n.param_loop. param="poll_node_id">
        <n.get_node_from_id. node_id="[n.current_parameter_value/]">
            <n.set_local_node.this_node />
            <n.if.visitor.is_registered>
                <then>
                    <n.poll_option_list.loop.>
                        var input = '<n.local_node.poll_vote_input_field field_id="option[n.option_id/]" index="[n.current_index/]"/>';
                        $('#poll-option-input<n.option_id/>').html(input);
                    </n.poll_option_list.loop.>
 
                    <n.if.poll_has_ended>
                        <then>
                            var input = '<t>This poll is closed.</t>';
                        </then>
                        <else>
                            var txt_vote = "<t>Vote</t>";
                            var input = '<input type="submit" value="' + txt_vote + '"/>';
                            if (!<n.visitor.can_create_poll_in.page_node/> )
                                input = '<input type="submit" value="' + txt_vote + '" disabled="true"/>';
 
                        </else> 
/(...)
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Managing vote permission

Mencey Melgar
Thanks, Im wondering, which is the "condition" to have the "permission" to vote? I mean which sense makes the poll_visitor_can_vote?
:) Helper
Reply | Threaded
Open this post in threaded view
|

Re: Managing vote permission

RafaelSantos
In reply to this post by Pedro
Thanks for your reply. Helped me a lot.
Encuentra сasinos online de Estados Unidos en es.casinority.com/us/.