I'm trying to use Pollfield to add Poll functionality to my forum topics, but when viewing the node, the poll choices are not showing. At first everything works perfectly normal: adding the field to my content type, configuration, and even creating a new node and adding the poll question, possible answer choices, and setting all the different options, no problem there.
When viewing the node, I can see the question, but the options to vote on are not displayed. Checking the source code, I can see a pollfield form (with id "pollfield-voting-function-form") but it only has 3 hidden fields and nothing else. Also checking on the node variables, on $node->field_poll[0]['choice'] I can see a coded string which contains my poll choices, but they're never actually rendered as a form.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pollfield.module.patch | 2.86 KB | mr.j |
| #2 | pollfield.module.patch | 3.03 KB | mr.j |
Comments
Comment #1
mr.j commentedSame bug. Sometimes you save the node and the choices show up. Sometimes they do not, then you can edit the node and save and they show up, only to disappear again if the node is edited again.
There are many bugs in the code that saves the choices in pollfield_field. Variable name spelling errors, unsetting elements in an array while looping the same array then referring to those elements by array index, referring to the wrong arrays and more. I am amazed it ever worked at all. I have done my best to fix it without rewriting the whole thing but the code is horribly written and very hard to make sense of. It seems to be working fine for me now though.
EDIT: get patch in #2 below instead.
Comment #2
mr.j commentedAnother bug found and fixed on insert. This patch replaces the one above.
Also note that this issue is most likely related to this other one where the choices will not appear for anonymous users if a non-admin creates the poll:
#918548: Polls disabled when created or edited by users who don't have full permissions
Comment #3
bryan kennedy commentedThis issue to has expanded to cover several things, but I wanted to update that I cleaned up some of the hook_field function you mention in your patch. It's a first step in fixing some of these issues. I also made a few module wide variable spelling updates. Thanks for pointing out both of those issues. These fixes are in the latest dev. Once they are part of a larger working whole, I'll release a new version.
Comment #4
bryan kennedy commentedI think this issue is resolved. It is a duplicate of the fixed bug that mr.j pointed out.
This fix is only in the dev branch right now, but once I have some of the other major issues sorted out I'll roll a new release.
Comment #5
soundboy89 commentedThat did the trick. Thank you very, very much :)