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
Comment #1
Christoph Petschnig commentedOf course it should be
And it should also be stretched over more than one statement for better reading ;-)
Comment #2
maartenvg commentedWhy is there even a
GROUP BYstatement? The db_rewrite_sql query above it automatically turns then.nidinto adistinct(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_queryargument.Comment #3
pomliane commentedThis 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.