<?php
// Something like that should help, but you'll have to play with it to get it working:
// inside your functions.php file
function wpse16372_prevent_publish()
{
if ( ! is_admin() )
return;
// This should be ok, but should be tested:
$post_id = $GLOBALS['post']->ID;
echo '<pre>Test for post ID: '; print_r( $post_id ); echo '</pre>';// the actual test
// has_post_thumbnail() doesn't work/exist on/for admin screens (see your error msg). You need to find another way to test if the post has a thumbnail. Maybe some Javascript?
//if ( ! has_post_thumbnail( $post_id );
if ( ! has_post_thumbnail( $post_id ) )
{
?>
<!-- //
<script language="javascript" type="text/javascript">
alert( 'you have to use a featured image' );
</script>
// -->
<?php
exit; // abort
}
}
add_action( 'save_post', 'wpse16372_prevent_publish', 100 );
?>