| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | ---------- Enable visual editor on comments |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | add_filter( 'comment_form_defaults', 'custom_comment_form_defaults' ); |
|---|
| 8 | function custom_comment_form_defaults( $args ) { |
|---|
| 9 | if ( is_user_logged_in() ) { |
|---|
| 10 | $mce_plugins = 'inlinepopups, wordpress, wplink, wpdialogs'; |
|---|
| 11 | } else { |
|---|
| 12 | $mce_plugins = 'fullscreen, wordpress'; |
|---|
| 13 | } |
|---|
| 14 | add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') ); |
|---|
| 15 | ob_start(); |
|---|
| 16 | wp_editor( '', 'comment', array( |
|---|
| 17 | 'media_buttons' => false, |
|---|
| 18 | 'teeny' => true, |
|---|
| 19 | 'textarea_rows' => '7', |
|---|
| 20 | 'tinymce' => array( 'plugins' => $mce_plugins ) |
|---|
| 21 | ) ); |
|---|
| 22 | $args['comment_field'] = ob_get_clean(); |
|---|
| 23 | return $args; |
|---|
| 24 | } |
|---|