now the question of the poll is in the title of the block/box, which makes it multiline (problem with some skins). Wouldn't it be better to have a short title, and another field with the question? (and some explanation maybe)

Comments

al’s picture

This has been patched up by Kobus for the CVS trunk, but I'm not sure he's happy about the way he's done it (it should probably be using title/body/teaser, not add a custom db field). See http://lists.drupal.org/pipermail/drupal-devel/2003-April/023229.html for details.

Kobus’s picture

I will take this feature update for 4.1.0 (Official release). I'll also look in 4.1.0 branch in CVS as well as CVS version of Drupal, but going to do this one first in the correct manner.

Regards,

Kobus

Kobus’s picture

Kristjan,

You mentioned before that I could reuse the $node->body or $node->teaser field. I saw that $node->teaser was used already, so, I decided on $node->body, however, I can'ty figure out how this can be done without altering the poll table, as you sit with this query:

db_query("INSERT INTO poll (nid, runtime, voters, active) VALUES ('%d', '%d', '', '%d')", $node->nid, $node->runtime, $node->active);

There are no references to the node table in any of the SELECT, INSERT or UPDATE db_query instructions, so, I can't see how this is possible to do it the way you suggested by reusing the fields? You may assume that I am stupid and inexperience, because I am!

Would it really be a problem to create the extra field in the poll table?

Regards,

Kobus

al’s picture

Priority: Major » Normal
function poll_validate(&$node) {
  $node->teaser = poll_teaser($node);
}

Needs to have $node->body = [foo] added to it, where [foo] is the question text, obviously. You'll want to modify poll_teaser() and other things, obviously.

Updates to node objects aren't done using SQL statements - all that's handled for you by the base node class. I suggest you take a look at the book module for a more straightforward view of how to override node stuff.

al’s picture

Assigned: Unassigned » al
Steven’s picture

The sideblock title is fixed, I don't see how/why we should fix the main node title.

Gabriel R.’s picture

Questions and explanations are most of the time pretty long. I think that not having separate fields for title/question is a real problem.