Remove $_POST from insert choices

ckng - September 18, 2008 - 08:12
Project:Advanced Poll
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Advpoll is making use of $_POST['choice'] in _advpoll_insert_choices() as the mean to pass choice data.

This causes problem when an advpoll is not created through a form such as programatically create a poll, cloning the poll or other ways to modify the choices programatically.

In the comment: * Note: we pass choice data via _POST to allow for dynamic addition of choices.

I would suggest for the purpose of dynamic addition of choices to make use of a separate function and make the _advpoll_insert_choices() to take in values from $node or $form_values.

#1

ckng - September 18, 2008 - 17:00
Status:active» needs work

Attached is the patch for what I needed.
Come to think of it, where and when do 'we pass choice data via $_POST to allow for dynamic addition of choices'?

Perhaps $_POST data could be extracted as $node->choices before calling _advpoll_insert_choices()

AttachmentSize
advpoll-post.patch 2.3 KB
 
 

Drupal is a registered trademark of Dries Buytaert.