Multilingual Poll correctly propagates voting results in translated versions' pages, but the Last Poll starts to count for every translated version of the poll separately.

Comments

Jan Van Hyfte’s picture

Waiting for a "professional solution" i have made following changes to my Poll_Pages.Inc:

function poll_page() {
// List all polls.
+ global $language;
+ $langcode = $langcode ? $langcode : $language->language;
- $sql = db_rewrite_sql("SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");
+ $sql = db_rewrite_sql("SELECT n.nid, n.title, p.active, n.created, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.tnid = c.nid WHERE n.status = 1 and n.language = '" . $langcode . "' GROUP BY n.nid, n.title, p.active, n.created ORDER BY n.created DESC");

this solves the issue for me.

jose reyero’s picture

Status: Active » Fixed

You have to use the new block provided by the module for that: Most recent poll (Aggregated translations)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

clata’s picture

I applied your solution and it works fine for the multilingual poll page (the node I mean). Unfortunately I cannot say the same about the most recent poll block. It still reports different vote statistics depending on the used language for voting.

malc0mn’s picture

how about this:

<?php
  // List all polls.

  $sql = db_rewrite_sql("SELECT n.nid, n.title, p.active, n.created, x.votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN (SELECT n.tnid, SUM(c.chvotes) AS votes FROM {node} n INNER JOIN {poll} p ON n.nid = p.nid INNER JOIN {poll_choices} c ON n.nid = c.nid WHERE n.status = 1 GROUP BY n.tnid) x ON x.tnid = n.tnid WHERE n.status = 1");
?>

in /modules/poll/poll.pages.inc ofcourse...