Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: borish - joulukuu 10, 2013, 05:40:13 IP

Otsikko: Need multiple questions per poll
Kirjoitti: borish - joulukuu 10, 2013, 05:40:13 IP
Hello,

I need a mod that allows more than one question per poll. There's a mod http://custom.simplemachines.org/mods/index.php?mod=1586 (http://custom.simplemachines.org/mods/index.php?mod=1586) that seems to do just this, but it hasn't been updated since SMF 2.0 RC 4. I've installed this mod on SMF 2.0.6 using emulation mode, but creating a poll gives a database error null value in column "id_topic" violates not-null constraint. I use Postgresql 9.1 on Ubuntu 13.04. I assume that this mod doesn't work anymore for SMF 2.0.6 and I want to fix this. However, I haven't found any documentation on how polls work in SMF internally. Where should I start? Which fields are relevant for polls, what must be changed?
Otsikko: Re: Need multiple questions per poll
Kirjoitti: Arantor - joulukuu 10, 2013, 06:53:00 IP
The mod is not compatible with PostgreSQL. Most SMF mods aren't, really.

SMF's own PostgreSQL isn't that great, being honest, and realistically using MySQL will get you a better experience with SMF and its mods.
Otsikko: Re: Need multiple questions per poll
Kirjoitti: Oldiesmann - joulukuu 11, 2013, 01:37:30 AP
The problem is because they added a NOT NULL column without a default value.

Run these queries in phpPgAdmin to fix the issue:

ALTER TABLE smf_polls ALTER id_topic SET default 0;
UPDATE smf_polls SET id_topic = 0 WHERE id_topic IS NULL;


That should fix the issue, but as I haven't looked at the rest of the mod, there may be other areas where it will break (but I'll be happy to help you work around any other issues as well).
Otsikko: Re: Need multiple questions per poll
Kirjoitti: borish - joulukuu 11, 2013, 04:16:26 IP
The mod works with MySQL, no problmes so far. Thanks to Arantor Beeblebrox for pointing this out!