How can I add an automatic poll like here on the support forum?
2 posters
Page 1 of 1
How can I add an automatic poll like here on the support forum?
Hi, I'm having trouble adding an automatic poll to my forum. I'd like the auto poll to be activated for the suggestions
Forum Version: PHPBB3
Forum URL: http://theoriginals.4umotion.com/
Forum Version: PHPBB3
Forum URL: http://theoriginals.4umotion.com/
Last edited by Ghost on October 4th 2015, 5:07 pm; edited 2 times in total
Guest- Guest
Re: How can I add an automatic poll like here on the support forum?
You want it so the entire forum is polls? Or just regular topics (excluding sticky's, etc.)
Re: How can I add an automatic poll like here on the support forum?
regular topics.(excluding sticky's etc.)Ace 1 wrote:You want it so the entire forum is polls? Or just regular topics (excluding sticky's, etc.)
Guest- Guest
Re: How can I add an automatic poll like here on the support forum?
Hi @Ghost,
You can add this by going to Modules > JavaScript codes management > and create a new script
Placement : In all the pages
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.
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.
Re: How can I add an automatic poll like here on the support forum?
Thank you, @Ange Tuteur. Also for sub-forums, am I suppose to do the same?
Guest- Guest
Re: How can I add an automatic poll like here on the support forum?
If you're applying this to multiple forums then I'd suggest this approach :
At the top is an array called "forums", it contains multiple forum ids that the script should be applied to. Make sure to separate each id by a comma.
- Code:
window.location.pathname == '/post' && $(function () {
var forums = [1, 2, 3, 14],
lang = {
info : 'The poll will be added automatically.',
poll_question : 'Do you agree or disagree ?',
poll_answers : 'Agree\nDisagree'
},
i = 0,
j = forums.length,
f;
if (document.post && document.post.mode.value == 'newtopic') {
f = document.post.f.value;
for (; i < j; i++) {
if (f == forums[i]) {
$(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" />');
break;
}
}
}
});
At the top is an array called "forums", it contains multiple forum ids that the script should be applied to. Make sure to separate each id by a comma.
Re: How can I add an automatic poll like here on the support forum?
Okay, thanks.
topic solved
topic solved
Guest- Guest
Re: How can I add an automatic poll like here on the support forum?
No problem.
Topic archived
Have a good day.
Topic archived
Have a good day.
Similar topics
» How to create automatic post page like Support Forum
» iSupport - An Unofficial support forum of ForuMotion
» I only came to contact support. Why make me post multiple posts in a forum, to be allowed to contact support?
» recommend me a theme wich match with my forum ( It support forum )
» Forum Automatic Prune
» iSupport - An Unofficial support forum of ForuMotion
» I only came to contact support. Why make me post multiple posts in a forum, to be allowed to contact support?
» recommend me a theme wich match with my forum ( It support forum )
» Forum Automatic Prune
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum