by Ange Tuteur October 4th 2015, 4:16 pm
Hi
@Ghost,
You can add this by going to Modules > JavaScript codes management > and create a new script
Placement : In all the pages
- Code:
window.location.pathname == '/post' && $(function () {
var lang = {
info : 'The poll will be added automatically.',
poll_question : 'Do you agree or disagree ?',
poll_answers : 'Agree\nDisagree'
};
if (document.post && document.post.mode.value == 'newtopic' && document.post.f.value == 14) {
$(document.post.poll_title).closest('fieldset').html('<strong>' + lang.info + '</strong><input type="hidden" name="poll_title" value="' + lang.poll_question + '" /><input type="hidden" name="poll_option_text" value="' + lang.poll_answers + '"><input type="hidden" name="poll_length" value="30" /><input type="hidden" name="poll_cancel_vote" value="1" />');
}
});
The 14 in
document.post.f.value == 14 is the id of the forum this will be applied to.
At the top of the script you can adjust the language settings and poll answers. Note that multiple answers should be separated by
\n also known as a "newline" character.