News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[Implemented] Set max days for polls

Started by dschwab9, January 03, 2004, 08:56:37 AM

Previous topic - Next topic

dschwab9

There is a hard-coded limit of 14 days for the expiring polls.  This should be an option in the admin center.

We run a monthly poll that runs for 21 days, and I just had one of my moderators spend a lot of time typing up a poll and post, hit post, and it said there was a max of 14 days, and when he hit back, all the work was gone  >:(

Jeff Lewis

When making a poll, there is a box where you can enter the number of days for the poll to run...or am I misunderstanding the question?
Co-Founder of SMF

dschwab9

Quote from: Jeff Lewis on January 03, 2004, 09:13:45 AM
When making a poll, there is a box where you can enter the number of days for the poll to run...or am I misunderstanding the question?

You misunderstood.   There is a hardcoded limit of 14 days for that box.  If you enter a number bigger than 14, it gives an error and you loose everything.  The only way to change that limit is to edit Post.php

Jeff Lewis

Ah ok I see what you mean...not sure why it was hardcoded as 14 days as that doesn't make much sense (things like poll of the month). I assume you found where to alter that for now as you said you found it in Post.php.

I'll ask the guys why they chose 14 and will probably change it in the CVS...any suggestions on a hardcoded max? Personally don't know if there should be one...
Co-Founder of SMF

Grudge

Ummm... sorry - that was me who choose 14 days I think. No reason for it as far as I remember... seemed like a sensible limit at the time :D

I still think there SHOULD be a hard coded max. I would recommend 90 days personally. If you wish make it a mod setting, but I think it should be there.
I'm only a half geek really...

Jeff Lewis

My vote is to remove it, we already allow a poll to run forever....
Co-Founder of SMF

[Unknown]

Grudge, can you message me the code for either a setting or removal?

-[Unknown]

Jeff Lewis

A setting is useless in my mind since we already allow polls to last forever. Instead I'd alter or remove the section of code in Post.php around line 730:


// If the user tries to set the poll too far in advance, don't let them.
if (!empty($_POST['poll_expire']) && ($_POST['poll_expire'] < 1 || $_POST['poll_expire'] > 14))
fatal_lang_error('poll_range_error', false);


Still do need to check to see if it's less than 1 which would mean it would need a language change as well.
Co-Founder of SMF

Grudge

Well... change it to something like this then:

// If the user tries to set the poll too far in advance, don't let them.
if (!empty($_POST['poll_expire']) && ($_POST['poll_expire'] < 1 || $_POST['poll_expire'] > 1500))
fatal_lang_error('poll_range_error', false);


The reason I want an upper limit hard coded is incase someone comes up with some ridiculous number like 99999999999 which somehow causes a problem later on. 1500 days is acceptable I would guess :)
I'm only a half geek really...

dschwab9

I don't see a reason to have a limit either, but I think if there is one, it should be an option.

[Unknown]

Bah, whatever.  I've removed the limit, hopefully it doesn't come back at us.

-[Unknown]

dschwab9

Quote from: [Unknown] on January 03, 2004, 10:50:38 AM
Bah, whatever.  I've removed the limit, hopefully it doesn't come back at us.

-[Unknown]

My concern would be that it uses Unix time.  Don't know if there's a limit to the time system or not, but what would happen if someone entered 10 million days or something?
Why not just make it a year limit or something?

[Unknown]

If it goes over, it will just round down - MySQL does this automatically.

-[Unknown]

Tyris

why not use '0' for 'forever', and have a limit of 1500 days 'inputted'... that way they can select a limit if they want one (up to 1500 days), bbut if they want no limit, thats easy to... and if they do a number higher than 1500 it just throws an error (doesnt lose poll options obviously tho ;)).

nil

The only time I see this really having any effect is in a "poll of the month" situation and IMHO it  seems easier just to set the poll to forever and then close it whenever you want to.

Advertisement: