From e70b7d04b749237686c276db5707df7694f4376a Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 8 Jul 2013 10:37:04 -0700 Subject: [PATCH] Fix: Display blog-calendar of current month, regardless of if posts exist --- e107_plugins/blogcalendar_menu/blogcalendar_menu.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/e107_plugins/blogcalendar_menu/blogcalendar_menu.php b/e107_plugins/blogcalendar_menu/blogcalendar_menu.php index a277bdb03..6807177f8 100644 --- a/e107_plugins/blogcalendar_menu/blogcalendar_menu.php +++ b/e107_plugins/blogcalendar_menu/blogcalendar_menu.php @@ -23,6 +23,7 @@ if (!defined('e107_INIT')) { exit; } $cString = 'nq_news_blogacalendar_menu_'.preg_replace('#[^\w]#', '', $parm); $cached = e107::getCache()->retrieve($cString); + if(false === $cached) { @@ -106,12 +107,12 @@ if(false === $cached) $year_start = mktime(0, 0, 0, 1, 1, $req_year); $year_end = mktime(23, 59, 59, 12, 31, $req_year); - $sql->db_Select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)); + $sql->select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)); $links = array(); $months = array(); - while ($news = $sql->db_Fetch()) + while ($news = $sql->fetch()) { $xmonth = date("n", $news['news_datestamp']); $xyear = date("Y", $news['news_datestamp']); @@ -141,10 +142,13 @@ if(false === $cached) // go over the link array and create the option fields + if(!isset($months[$cur_year][$cur_month])) // display current month even if no links available. + { + $months[$cur_year][$cur_month] = 1; + } - // ------------------------ // create and show calendar