Duplicate Disable Polls per Forum/Node

Ludachris

Well-known member
In some forums it doesn't make sense to have polls posted. I'd like to turn them off for those forums but not for all forums. Makes sense right?

In the meantime, is there some conditional code I can add into the "thread_create" template to check for an array of forumID's, and if true, hide the poll stuff? Maybe add in a style="display:none" on that div tag?
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
I saw that thread but only read the first post and clicked back, as it looked like he was suggesting a usergroup permission which is already part of XF core. Thought the thread was old.
 
I did it with the built in template modification system

Template: thread_create

Find
Code:
<h3 class="textHeading">{xen:phrase post_poll}</h3>
   <dl class="ctrlUnit">
     <dt><label for="ctrl_poll_question">{xen:phrase question}:</label></dt>
     <dd><input type="text" name="poll[question]" class="textCtrl" id="ctrl_poll_question" maxlength="100" /></dd>
   </dl>
   <dl class="ctrlUnit">
     <dt>{xen:phrase possible_responses}:</dt>
     <dd>
       <ul class="PollResponseContainer">
         <xen:foreach loop="$pollExtraArray" value="$null">
           <li class="PollNonJsInput"><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
         </xen:foreach>
         <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
         <li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
       </ul>
       <input type="button" value="{xen:phrase add_additional_response}" class="button smallButton FieldAdder JsOnly" data-source="ul.PollResponseContainer li" data-maxfields="{$xenOptions.pollMaximumResponses}" />
     </dd>
   </dl>

   <!-- slot: after_poll_responses -->
   <dl class="ctrlUnit">
     <dt></dt>
     <dd>
       <ul>
         <li><label for="ctrl_poll_multiple"><input type="checkbox" name="poll[multiple]" value="1" id="ctrl_poll_multiple" /> {xen:phrase allow_selection_of_multiple_responses}</label></li>
         <li><label for="ctrl_poll_public_votes"><input type="checkbox" name="poll[public_votes]" value="1" id="ctrl_poll_public_votes" /> {xen:phrase display_votes_publicly}</label></li>
         <li><label for="ctrl_poll_close"><input type="checkbox" name="poll[close]" value="1" class="Disabler" id="ctrl_poll_close" /> {xen:phrase close_this_poll_after}:</label>
           <ul id="ctrl_poll_close_Disabler">
             <li>
               <input type="text" size="5" name="poll[close_length]" value="7" class="textCtrl autoSize" />
               <select name="poll[close_units]" class="textCtrl autoSize">
                 <option value="hours">{xen:phrase hours}</option>
                 <option value="days" selected="selected">{xen:phrase days}</option>
                 <option value="weeks">{xen:phrase weeks}</option>
                 <option value="months">{xen:phrase months}</option>
               </select>
             </li>
           </ul>
         </li>
       </ul>
     </dd>
   </dl>

Replace (nodes 10 and 138 will not have the poll option)
Code:
<xen:if is="!in_array({$forum.node_id}, array(10,138))">
$0
</xen:if>

Template: thread_create

Find
Code:
<dl class="ctrlUnit submitUnit">
     <dt></dt>
     <dd>
       <input type="submit" value="{xen:phrase create_thread}" class="button primary" />
       <input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" />
     </dd>
   </dl>

Replace (nodes 10 and 138 will not have the poll option)
Code:
<xen:if is="!in_array({$forum.node_id}, array(10,138))">
$0
</xen:if>
 
I saw that thread but only read the first post and clicked back, as it looked like he was suggesting a usergroup permission which is already part of XF core. Thought the thread was old.
There is no user group permission to control creation of polls, only voting in polls.

The suggestion is to create a permission for creating polls, which would allow you to accomplish what you'd like to do.
 
In some forums it doesn't make sense to have polls posted. I'd like to turn them off for those forums but not for all forums. Makes sense right?

In the meantime, is there some conditional code I can add into the "thread_create" template to check for an array of forumID's, and if true, hide the poll stuff? Maybe add in a style="display:none" on that div tag?
The add-on User Essentials, which you already have, will allow you to do that. Simply revoke the permission to create a poll from desired user groups using the node (forum) permissions.
 
Top Bottom