Commit d5a785b4 authored by jcnventura's avatar jcnventura

Issue #1635494: fix the SQL used to display the 'Most *' blocks to handle table prefixes.

parent d53a01f5
......@@ -188,7 +188,7 @@ function print_block_view($delta = '') {
switch ($delta) {
case 'print-top':
$block['subject'] = t('Most printed');
$result = db_query_range("SELECT path FROM {print_page_counter} LEFT JOIN {node} ON path = CONCAT('node/', node.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
$result = db_query_range("SELECT path FROM {print_page_counter} LEFT JOIN {node} n ON path = CONCAT('node/', n.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
->fetchAll();
if (count($result)) {
$items = array();
......
......@@ -90,7 +90,7 @@ function print_epub_block_view($delta = 0) {
switch ($delta) {
case 'print_epub-top':
$block['subject'] = t('Most EPUBd');
$result = db_query_range("SELECT path FROM {print_epub_page_counter} LEFT JOIN {node} ON path = CONCAT('node/', node.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
$result = db_query_range("SELECT path FROM {print_epub_page_counter} LEFT JOIN {node} n ON path = CONCAT('node/', n.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
->fetchAll();
if (count($result)) {
$items = array();
......
......@@ -130,7 +130,7 @@ function print_mail_block_view($delta = 0) {
switch ($delta) {
case 'print_mail-top':
$block['subject'] = t('Most emailed');
$result = db_query_range("SELECT path FROM {print_mail_page_counter} LEFT JOIN {node} ON path = CONCAT('node/', node.nid) WHERE status <> 0 OR status IS NULL ORDER BY sentcount DESC", 0, 3)
$result = db_query_range("SELECT path FROM {print_mail_page_counter} LEFT JOIN {node} n ON path = CONCAT('node/', n.nid) WHERE status <> 0 OR status IS NULL ORDER BY sentcount DESC", 0, 3)
->fetchAll();
if (count($result)) {
$items = array();
......
......@@ -101,7 +101,7 @@ function print_pdf_block_view($delta = 0) {
switch ($delta) {
case 'print_pdf-top':
$block['subject'] = t('Most PDFd');
$result = db_query_range("SELECT path FROM {print_pdf_page_counter} LEFT JOIN {node} ON path = CONCAT('node/', node.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
$result = db_query_range("SELECT path FROM {print_pdf_page_counter} LEFT JOIN {node} n ON path = CONCAT('node/', n.nid) WHERE status <> 0 OR status IS NULL ORDER BY totalcount DESC", 0, 3)
->fetchAll();
if (count($result)) {
$items = array();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment