After installing WP-Crontrol in WordPress 3.0.1, I got the following warning messages. (These messages were visible only because I was using the plugin WP Developer Assistant, with the option set to ‘Enable display of errors on all pages for this user’. Absent this plugin, the warning messages do not show.)
Warning: array_merge() [function.array-merge.php]: Argument #1 is not an array in [PATH]\wp-content\plugins\wp-crontrol\wp-crontrol.php on line 296 Warning: array_keys() [function.array-keys.php]: The first argument should be an array in [PATH]\wp-content\plugins\wp-crontrol\wp-crontrol.php on line 305 Warning: in_array() [function.in-array.php]: Wrong datatype for second argument in [PATH]\wp-content\plugins\wp-crontrol\wp-crontrol.php on line 344
The problem is the plugin’s activate function does not run as expected, when the plugin is activated. This activation function creates the option ‘crontrol_schedules’, and without that option in the wp_options table, the errors occur and trigger the warning messages.
The easiest workaround is to go to the Settings | Crontol page and add a new cron schedule. This is nothing more than an custom interval that can be used to specify the frequency with which jobs can be run. For example, you can specify a new interval with the following entries:
Internal name: everytwoweeks Interval: 1209600 Display name: Every Two Weeks
Now press ‘Add Cron Schedule’ and the option ‘crontrol_schedules’ will be written to the database and the errors messages will cease. Note that this option will persist in the database, even if the plugin is deleted.
An alternative workaround is to edit the file ‘plugins\wp-control\wp-control.php’. Add the line ( if(!get_option… ) shown below at the bottom of the Crontrol function (near line 61).
add_action(CRONTROL_CRON_JOB, array(&$this, 'php_cron_entry')); // function activate is never run to create option 'crontrol_schedules', so run it if needed if(!get_option('crontrol_schedules')) $this->activate(); }
- The topic ‘[Plugin: WP-Crontrol] Warning Messages running with WordPress 3’ is closed to new replies.