Skip to:
Content
Pages
Categories
Search
Top
Bottom

TinyMCE for replying to messages

Viewing 5 replies - 1 through 5 (of 5 total)

  • tronix-ex
    Participant

    @tronix-ex

    Thats right me either need this as its working in the compose message but not in reply message.

    Please help.


    danbp
    Participant

    @danbp

    Hi guys,

    you should read topics completely! 👿
    In one of my answer to the above mentionned, you have the necessary information to get it to work for replies. I tested it today and it works for me.

    Now I repeat it again, it’s not done to add wp_editor to a textarea which was never intented to be a post editor. It’s a simple message composer ! Do you write MMS with Word ?

    By adding wp_editor to this composer, you can only add the the HTML editor, like the one you have on this forum. The visual tab won’t work because of numerous filters and the way wp_editor is working. Activating the visual tab on the compose screen will also break your theme, in 99% of cases.

    Once you have it correctly displayed, you will see that most of the tags will be striped. This can be avoided by defining $allowedtags in wp_kses filter. The inconvenient of this is that it will also be available on what’s new form and any other form you use on your site. So, you’re warned.

    The code i used today, including allowed tags i had to activate.

    function bpfr_compose_msg_tiny_editor() {
    add_filter ( 'user_can_richedit' , create_function ( '$a' , 'return false;' ) , 50 );
    
    $content = "";
    	
    	if ( isset( $_GET['r'] ) ) :
    	$content = esc_textarea( $_GET['r'] ); 
    	endif;
    
    	$editor_settings = array(
    		'content' => bp_messages_content_value(),
    		'textarea_name' => 'content',
    		'editor_id' => 'message_content',
    		'teeny'=>true,
    		'media_buttons'=>false,
    		'quicktags' => array(
    			'buttons' => 'strong,em,link,img,block,del,ul,ol,li,code,close'
    	) ); 
    
    	wp_editor( bp_messages_content_value(), 'message_content', $editor_settings); 
    
    }
    add_action( 'compose_edit_tools', 'bpfr_compose_msg_tiny_editor' );
    
    function bpex_allowed_tags() {
    	global $allowedtags;
    	$allowedtags['img']		= array( 'src' => array () );
    	$allowedtags['ul']		= array();
    	$allowedtags['ol']		= array();
    	$allowedtags['li']		= array();	
    }
    add_action('init', 'bpex_allowed_tags', 10);
    

    How-to is explained on the other topic.


    tronix-ex
    Participant

    @tronix-ex

    Hi Danbp,

    Thanks for your help and the span tag is now working like a charm. But why the rich texteditor is not working for messages/single.php, I am using the same function as messages/compose.php for single also but it gives error There was a problem sending that reply. Please try again.

    Please help on this.

    Thanks,


    danbp
    Participant

    @danbp

    You don’t need help, but to understood that you can’t use the visual editor for messages. You use it and that why you get the error message. Re re re re re read the topic again.

    I’m closing this topic now.


    Venutius
    Moderator

    @venutius

    As a follow up to this, in order to add a rich text editor to the message reply page you would need to overload the file members/single/messages/single.php

    Replace:

    <textarea name="content" id="message_content" rows="15" cols="40"></textarea>

    with:

    <?php do_action( 'compose_edit_tools' ); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘TinyMCE for replying to messages’ is closed to new replies.
Skip to toolbar