Announcement

Collapse
No announcement yet.

Set Make Poll Public as Default?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Set Make Poll Public as Default?

    Can I set the "Make Poll Public" option as default? I have been getting questions about how to change this when users have already made the poll, so i'm assuming they are not reading the options, and not checking "Make Poll Public" when my users post a poll, so i'd like to just set it as default. Thank you!!!

  • #2
    Do you mean the 'Make Votes Public' checkbox? If so, edit the 'contententry_panel_poll' template and change this line (should be line 35):

    Code:
                    <label class="b-form-control__label"><input type="checkbox" name="public" class="b-form-control__control" value="1"<vb:if condition="$conversation['public']"> checked="checked"</vb:if> tabindex="0" /><span class="b-form-control__text">{vb:phrase make_votes_public}</span></label>
    to this:

    Code:
                    <label class="b-form-control__label"><input type="checkbox" name="public" class="b-form-control__control" value="1"<vb:if condition="$conversation['public']"> checked="checked"</vb:if> tabindex="0" checked /><span class="b-form-control__text">{vb:phrase make_votes_public}</span></label>
    Vote for:

    - *Admin Settable Paid Subscription Reminder Timeframe*
    -
    *PM - Add ability to reply to originator only*
    - Add Admin ability to auto-subscribe users to specific channel(s)
    - "Quick Route" Interface...

    Comment


    • #3
      Originally posted by Trevor Hannant View Post
      Do you mean the 'Make Votes Public' checkbox? If so, edit the 'contententry_panel_poll' template and change this line (should be line 35):

      Code:
       <label class="b-form-control__label"><input type="checkbox" name="public" class="b-form-control__control" value="1"<vb:if condition="$conversation['public']"> checked="checked"</vb:if> tabindex="0" /><span class="b-form-control__text">{vb:phrase make_votes_public}</span></label>
      to this:

      Code:
       <label class="b-form-control__label"><input type="checkbox" name="public" class="b-form-control__control" value="1"<vb:if condition="$conversation['public']"> checked="checked"</vb:if> tabindex="0" checked /><span class="b-form-control__text">{vb:phrase make_votes_public}</span></label>
      If you do that and when a user made a poll private, editing the poll will always make public checked and user will need to always uncheck it every time.
      The better solution should be to only set it to public if $conversation is null which occurs when you are just starting a poll topic and not when you're editing an existing poll topic.
      Code:
      <vb:if condition="empty($conversation)">
          {vb:set conversation.public, 1}
      </vb:if>
      You add the above code at the top of the contententry_panel_poll template and no need to modify the <input> for "Make vote public" checkbox.

      But the best solution is to create a template hook and to not modify the existing templates at all for maintenance reasons (as the change may be overwritten or cause merge conflict that you have to resolve every time you upgrade). The template hook location should be 'editor_additional_panels' and the template code is:

      Code:
      <script>
      (function() {
          document.addEventListener('DOMContentLoaded', function(){
              var publicCheckbox = document.querySelector('.new-content-widget .b-content-entry-panel__content--poll .b-form-control__control[name="public"]');
              if (publicCheckbox) {
                  publicCheckbox.checked = true;
              }
          });
      
      })();
      </script>
      If you don't know how to create a template hook, you can follow the similar instructions on one of my mods in my signature.

      GIPHY for vB5 AutoLinker Auto-Create Flag Report INITIALS AVATAR (Better) Name Card Quote Selected Text Likes Summary Disable AJAX Pagination Stop Links in Posts...& MORE!

      Comment


      • OverallOpinion
        OverallOpinion commented
        Editing a comment
        Is there a resource you can send me for a template hook? I'm unfamiliar with that.

      • glennrocksvb
        glennrocksvb commented
        Editing a comment
        Check out my signature as I mentioned.

    • #4
      Thanks for the speedy replies guys, I appreciate it!

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X