Make WordPress Core

Ticket #20822: wysiwyg-comments.php

File wysiwyg-comments.php, 701 bytes (added by jb510, 14 years ago)
Line 
1<?php
2/*
3---------- Enable visual editor on comments
4*/
5
6
7add_filter( 'comment_form_defaults', 'custom_comment_form_defaults' );
8function 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}