Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi,

    To all having the same problem: Fatal error: Call to a member function mt_clear_cache() on boolean…. A possible workaround is to add $maintenance = new maintenance(); before $maintenance->mt_clear_cache(); in plugin-folder/includes/admin.php function mt_register_settings(). Since mt_clear_cache() is a public static fuction, we need to initialize the variables.

    The function mt_register_settings() in admin.php should be like this (after the change):

    function mt_register_settings() {
    		global	$maintenance;
    		if ( !empty($_POST['lib_options']) && check_admin_referer('maintenance_edit_post','maintenance_nonce') ) {
    			if (!isset($_POST['lib_options']['state'])) { $_POST['lib_options']['state'] = 0; }
    			else {	   $_POST['lib_options']['state'] = 1; }
    
    			if (isset($_POST['lib_options']['htmlcss'])) {
    				$_POST['lib_options']['htmlcss'] = wp_kses_stripslashes($_POST['lib_options']['htmlcss']);
    			}
    
    			if (isset($_POST['lib_options'])) {
    			    update_option( 'maintenance_options',  $_POST['lib_options']);
    				$maintenance = new maintenance();
    				$maintenance->mt_clear_cache();
    			}
    		}
    	}

    I`m using php 5.6, btw.

    And great plugin. Thank you.

Viewing 1 replies (of 1 total)