• Hello,

    After we updated to Leads version 1.6.4 I lost the WP dashboard. we have the defaul php / css files that we have not edited…

    The bug seems to also lock the “Screen Options” menu (and help menu) up on top-right, so that I can not choose the options onm Dashboard what to activate what not.

    The same “Dashboard dissapearing” issue happends in both WP versions 4.1.3 and the new 4.2.

    Any idea / solution to get it back working?

    <b>Fatal error</b>:
    Call to undefined function cal_days_in_month() in <b>/home/..../public/html/wp-content/plugins/leads/classes/class.dashboard.php</b>
    on line <b>368</b><br />

    When we deactivate the Leads-plugin the dashbaord comes back as normal (see screeshot)

    We looked the WP support (link here) but did not find solution and to be honest I prefer to use defaul code not to modify php/css (even I could)…
    https://codex.wordpress.org/Dashboard_Widgets_API

    I copied the extract of the Chorme debug in below (###)…

    Any help would be welcomed.

    Many thanks,

    Marcus

    ### Debug extract when Leads plugin was activated (bug) , the most interesting parts (text split = ***): ###
    WP releases 4.2 and 4.1.3
    InboundNow Leads rel. 1.6.4

    <div id="dashboard-widgets-wrap">
    	<div id="dashboard-widgets" class="metabox-holder">
    	<div id="postbox-container-1" class="postbox-container">
    	<div id="normal-sortables" class="meta-box-sortables"><div id="dashboard_activity" class="postbox  hide-if-js">
    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span>Activity</span></h3>
    <div class="inside">
    <div id="activity-widget"><div class="no-activity"><p class="smiley"></p><p>No activity yet!</p></div></div></div>
    </div>
    <div id="wp-lead-stats" class="postbox ">
    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span>Lead Stats</span></h3>
    <div class="inside">
    <div id="lead-before-dashboard"></div>
    		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/wp-content/plugins/lead-dashboard-widgets/js/flot/excanvas.min.js"></script><![endif]-->
    
    		<div class="wp_leads_dashboard_widget">
    
    		<script type="text/javascript">
    		/* <![CDATA[ */
    		window.data1 = [ <br />
    <b>Fatal error</b>:  Call to undefined function cal_days_in_month() in <b>/home/..../public/html/wp-content/plugins/leads/classes/class.dashboard.php</b> on line <b>368</b><br />
    </script></div></div></div></div></div></div></div>
    
    *** another part of the debug (of the dashboard) ***
    
    <div id="dashboard-widgets" class="metabox-holder">
    	<div id="postbox-container-1" class="postbox-container">
    	<div id="normal-sortables" class="meta-box-sortables"><div id="dashboard_activity" class="postbox  hide-if-js">
    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span>Activity</span></h3>
    <div class="inside">
    <div id="activity-widget"><div class="no-activity"><p class="smiley"></p><p>No activity yet!</p></div></div></div>
    </div>
    <div id="wp-lead-stats" class="postbox ">
    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span>Lead Stats</span></h3>
    <div class="inside">
    <div id="lead-before-dashboard"></div>
    		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/wp-content/plugins/lead-dashboard-widgets/js/flot/excanvas.min.js"></script><![endif]-->
    
    		<div class="wp_leads_dashboard_widget">
    
    		<script type="text/javascript">
    		/* <![CDATA[ */
    		window.data1 = [ <br />
    <b>Fatal error</b>:  Call to undefined function cal_days_in_month() in <b>/home/directory/public/html/wp-content/plugins/leads/classes/class.dashboard.php</b> on line <b>368</b><br />
    </script></div></div></div></div></div></div>
    
    *** another part of the debug (of the dashboard) ***
    
    <li id="wp-admin-bar-inbound-admin-bar" class="menupop inbound-nav-marketing"><div class="ab-item ab-empty-item" aria-haspopup="true" title="Inbound Marketing Admin"> Marketing</div>
    <div class="ab-sub-wrapper">
    <ul id="wp-admin-bar-inbound-admin-bar-default" class="ab-submenu">
    ..... (removed some code)...
    <ul id="wp-admin-bar-inbound-secondary" class="ab-sub-secondary ab-submenu">
    ..... (removed some code)...
    <li id="wp-admin-bar-inbound-debug" class="menupop  inbound-new-tab">
    <a class="ab-item" aria-haspopup="true" href="#" target="_blank">
    <span style="color:#fff;font-size: 13px;margin-top: -1px;display: inline-block;">Debug Tools</span></a>
    	<div class="ab-sub-wrapper"><ul id="wp-admin-bar-inbound-debug-default" class="ab-submenu">
    		<li id="wp-admin-bar-inbound-debug-checkjs" class="inbound-new-tab">
    		<a class="ab-item" href="http://www.domainname.com/wp-admin/index.php?inbound_js" target="_blank" title="Click here to check javascript errors on this page">Check for Javascript Errors</a>
    		</li>
    		<li id="wp-admin-bar-inbound-debug-turnoffscripts" class="inbound-new-tab"><a class="ab-item" href="http://www.domainname.com/wp-admin/index.php?inbound-dequeue-scripts" target="_blank" title="Click here to remove broken javascript to fix issues">Remove Javascript Errors</a>
    		</li>
    		</ul>
    	</div>
    </li>

    ### end of debug ###

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi will you open this ticket on http://support.inboundnow.com and include your server’s PHP version.

    It may need to be upgraded to support cal_days_in_month function() which came out in 4.1.0

    http://php.net/manual/en/function.cal-days-in-month.php

    Thread Starter Marcus

    (@ademola)

    Thank you for fast reply, very helpful.
    Which PHP version should work correct?

    My Current PHP version seems to be 5.4.27…(see below used REDbot.org to check the PHP version here the info)

    HTTP/1.1 200 OK
        Date: Tue, 12 May 2015 08:50:01 GMT
        Server: Apache/2.4.3 (Unix) OpenSSL/1.0.1
        X-Powered-By: PHP/5.4.27
        X-Pingback: http://www.domainname.xx/xmlrpc.php
        Link: <http://www.domainname.xx/>; rel=shortlink
        Keep-Alive: timeout=5, max=99
        Connection: Keep-Alive
        Transfer-Encoding: chunked
        Content-Type: text/html; charset=UTF-8

    According Google-Code version 5 should be sufficient to work

    cal_days_in_month() is a PHP function, available in PHP 4.1+, and PHP 5+. Alternatively, your PHP installation may have been compiled without the –enable-calendar option.

    Is there a way to find out is the PHP installation compiled correctly?

    Many thanks in advance

    ps. I tried to access the Inbound support page but its closed all the time (I guess its open only for people on North American timezones)

    Although it says closed it still accepts submissions in closed hour times.

    Looking into the issue more it looks like your version of PHP is not compiled with calendar support. Will you contact your host and ask them for assistance?

    http://objectmix.com/php/489605-cal_days_in_month-missing-how-can-i-tell-if-exists.html

    In the meantime I’ll try and develop some fail safes to prevent fatal errors.

    Thread Starter Marcus

    (@ademola)

    Thank you very much. Meanwhile waiting for hosting provider to reply…

    The Fatal error is caused by php-script class.dashboard.php

    Additionally I tested this by running “Shortcode Exec PHP”-plugin (https://wordpress.org/plugins/shortcode-exec-php/ )

    It seems to lead to error with original script as well (test1)

    $this_year = _x('Y', 'timezone date format');
    $this_year =	date_i18n($this_year);
    echo " This year is $this_year !";
    $days_in_month = cal_days_in_month( CAL_GREGORIAN, $month, $this_year);
    echo " Days in Month (test1) is $days_in_month !";

    OUTPUT (test1 – with error) WYSIWYG

    This year is 2015 !
    Fatal error: Call to undefined function cal_days_in_month() in …wp-content/plugins/shortcode-exec-php/shortcode-exec-php-class.php(995) : eval()’d code on line 4

    However, when I run another script (test2) the cal_days_in_month function seems to work….

    if (!extension_loaded('calendar'))
    {
    function cal_days_in_month($month, $year)
    {
    return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30);
    }
    }
    $days_in_month = cal_days_in_month( CAL_GREGORIAN, $month, $year );
    echo " Days in Month (test2) is $days_in_month !";

    OUTPUT (test2) WYSIWYG

    Days in Month (test2) is 30 !

    .. which could indicate that the server side partially works, but I am not sure… as I still get the Fatal error on original script (similar to test1, that prints on Admin tool Dashboard)

    Below a section of the class.dashboard.php that cause the Fatal error

    Br, Marcus

    —-

    The error is on php-script located on “… \wp-content\plugins\leads\classes\class.dashboard.php”

    public static function get_lead_graph_data($month, $type)
    	{
    		global $wpdb;
    		global $table_prefix;
    
    		$wordpress_date_time = $timezone_format = _x('Y-m-d', 'timezone date format');
    		$wordpress_date_time =	date_i18n($timezone_format);
    		$wordpress_date = $timezone_day = _x('d', 'timezone date format');
    		$wordpress_date =	date_i18n($timezone_day);
    		$this_year = _x('Y', 'timezone date format');
    		$this_year =	date_i18n($this_year);
    		$loop_count = date('d',strtotime('last day of this month'));
    
    		$final_loop_count = cal_days_in_month(CAL_GREGORIAN, $month, $this_year); // Count of days in month
    
    		//echo $final_loop_count; // How many times to run
    		$lead_increment = 0;
    		for ($i = 1; $i < $final_loop_count + 1; $i++) {
    				// echo "hi" . $i;
    			$year = $this_year;
    			$day = $i;
    			$next_day = $i + 1;
    			$m = $month;
    			$Date = strtotime($year . "-" . $m . "-" . $day);
    			$Date_next = strtotime($year . "-" . $m . "-" . $next_day);
    			$clean_date_one = date('Y-m-d', $Date);
    			$clean_date_one_formatted = date('Y, n, d', $Date);
    			if ($type === "last-month"){
    				$Date = strtotime($year . "-" . $m . "-" . $day . ' +1 months');
    				$clean_date_one_formatted = date('Y, n, d', $Date);
    			}
    			$clean_date_two = date('Y-m-d', $Date_next);
    			//echo $clean_date_one . "";
    			$numposts = $wpdb->get_var(
    			$wpdb->prepare(
    				"SELECT COUNT(ID) ".
    				"FROM {$wpdb->posts} ".
    				"WHERE post_status='publish' ".
    					"AND post_type= %s ".
    					"AND {$table_prefix}posts.post_date BETWEEN %s AND %s",
    				'wp-lead' , $clean_date_one, $clean_date_two
    			)
    		);
    		$lead_increment += $numposts;
    		//echo "Day is: ". $day . " " . $numposts . " on " . $clean_date_one	.	"";
    		echo "[gd(". $clean_date_one_formatted . "), "	. $lead_increment . ", ". $numposts ."], ";
    		}
    
    	}
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dashboard windows dissapear – Leads plugin Fa0tal error javascript issue’ is closed to new replies.