Support » Plugin: Post Expirator » Multiple call to _scheduleExpiratorEvent causes constant error

  • Resolved Bas Schuiling

    (@basszje)


    I’m using a script that calls multiple times ( I have an array of posts-ID’s to schedule ) to _scheduleExpiratorEvent. However by the way of defining postExpiratorDebug which is called starting the function every next iteration leads to a ‘Notice: Constant is already defined’ error.

    Below I’m just returning when the constant is already set which leaves me no further errors ( but I can image it can be done a bit more solid than this ).

    function postExpiratorDebug() {
    	$debug = get_option('expirationdateDebug');
    if (defined("POSTEXPIRATOR_DEBUG")) return; // <-- my addition
    	if ($debug == 1) {
    		define('POSTEXPIRATOR_DEBUG',1);
                    require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php'); // Load Class
                    return new postExpiratorDebug();
    	} else {
    		define('POSTEXPIRATOR_DEBUG',0);
    		return false;
    	}
    }

    It’s no biggie but maybe some small improvement for next version 🙂

    http://wordpress.org/extend/plugins/post-expirator/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Multiple call to _scheduleExpiratorEvent causes constant error’ is closed to new replies.