Ad-minister plugin: Catchable fatal error

Ad-minister plugin: Catchable fatal error

Following the upgrade of WordPress to version 3.0 I noticed that there were some errors with the Ad-minister plugin, specifically on the main administration page (tools.php?page=ad-minister).

The page was now displaying an error message: Catchable fatal error: Object of class WP_Error could not be converted to string in ***/***/***/wp-includes/functions.php
on line 302

The error is due to a change in the way new posts are created in WP3. The fix (until such time as the plugin is updated by the authors) is to replace the following section of code in the administer_queue_scripts function in the ad-minister.php file:

// Create a new one
$_POST['post_title'] = 'Ad-minister Data Holder ' . $nbr;
$_POST['post_type'] = 'administer';
$_POST['content'] = 'This post holds your Ad-minister data';
$id = wp_write_post();
update_option('administer_post_id', $id);

with the new code:

// Create a new one
$adminster_post = array();
$adminster_post['post_title'] = 'Ad-minister Data Holder ' . $nbr;
$adminster_post['post_type'] = 'administer';
$adminster_post['content'] = 'This post holds your Ad-minister data';
$id = wp_insert_post( $adminster_post,true );
update_option('administer_post_id', $id);

8 comments on “Ad-minister plugin: Catchable fatal error

Leave a Reply

Your email address will not be published. Required fields are marked *