Paging has difficulties with the 'GROUP BY n.nid, n.title, p.active, n.created' part of the query. Replace in function advpoll_page() (line 79)

  $result = pager_query($sql, 15);

with

  $result = pager_query($sql, 15, 0, "SELECT COUNT(*) FROM {node} n INNER JOIN {advpoll} p ON n.nid = p.nid INNER JOIN {votingapi_cache} c ON n.nid = c.content_id WHERE n.status = 1 AND c.tag = '_advpoll' AND c.function='total_votes' AND c.content_type='advpoll'");

Comments

Christoph Petschnig’s picture

Of course it should be

  $result = pager_query($sql, 15, 0, db_rewrite_sql("SELECT ..."));

And it should also be stretched over more than one statement for better reading ;-)

maartenvg’s picture

Why is there even a GROUP BY statement? The db_rewrite_sql query above it automatically turns the n.nid into a distinct(n.nid), so it always returns only 1 node ID.
I believe
$sql = "SELECT n.nid, n.title, p.active, n.created, c.value AS votes FROM {node} n INNER JOIN {advpoll} p ON n.nid = p.nid INNER JOIN {votingapi_cache} c ON n.nid = c.content_id WHERE n.status = 1 AND c.tag = '_advpoll' AND c.function = 'total_votes' AND c.content_type = 'advpoll' ORDER BY n.created DESC";
suffices.

And this query doesn't need the extra $count_query argument.

pomliane’s picture

Status: Needs review » Closed (won't fix)

This version of Advanced Poll is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.