You can hook into tiny_mce_before_init
to modify the TinyMCE arguments to set the readonly
attribute.
For example (using PHP 5.3):
add_filter( 'tiny_mce_before_init', function( $args ) {
// do you existing check for published here
if ( 1 == 1 )
$args['readonly'] = 1;
return $args;
} );
This will make the TinyMCE readonly, however it won’t make the HTML editor readonly (that’s not TinyMCE) and it also won’t stop people using the Media Upload to insert images. However, that might not be an issue – because I would recommend you implement some server-side checking to prevent edits, as it’s always possible for someone to send whatever content they want from the browser by manipulating the DOM etc.