Commit e56fb43d authored by jcnventura's avatar jcnventura

Issue #1387868: don't display unpublished nodes on the most printed/pdf/emailed blocks.

parent bc66b068
......@@ -315,7 +315,7 @@ function print_block_view($delta = '') {
break;
case 'print-top':
$block['subject'] = t('Most printed');
$result = db_query_range("SELECT path FROM {print_page_counter} ORDER BY totalcount DESC", 0, 3)
$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)
->fetchAll();
if (count($result)) {
$block['content'] = '<div class="item-list"><ul>';
......
......@@ -116,7 +116,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} ORDER BY sentcount DESC", 0, 3)
$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)
->fetchAll();
if (count($result)) {
$block['content'] = '<div class="item-list"><ul>';
......
......@@ -143,7 +143,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} ORDER BY totalcount DESC", 0, 3)
$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)
->fetchAll();
if (count($result)) {
$block['content'] = '<div class="item-list"><ul>';
......
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