Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add tinymce to Activity Post Reply Form

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

  • danbp
    Moderator

    @danbp

    Sorry, i have no idea how to do that.


    bigkahunaburger
    Participant

    @bigkahunaburger

    @danbp Do you know what file the reply form is in?


    danbp
    Moderator

    @danbp

    buddypress/bp-templates/bp-legacy/buddypress/activity/entry.php

    Go here to search inside BuddyPress


    bigkahunaburger
    Participant

    @bigkahunaburger

    @danbp Thanks

    I almost got it working.

    I replaced lines 127 – 129 in the entry.php with this:

    <div class="ac-textarea">
       <?php do_action( 'activity_reply_textarea' ); ?>				
    </div>

    I then added this to my functions:

    function bpfr_reply_tiny_editor() {
    	// deactivation of the visual tab, so user can't play with template styles
    add_filter ( 'reply_user_can_richedit' , create_function ( '$a' , 'return false;' ) , 50 );
    	// adding tinymce tools
    	$editor_id = 'ac-input-bp_activity_id-';
    	$editor_class = 'ac-input bp-suggestions';
    		$settings = array( 
    		'textarea_name' => 'ac_input_bp_', 
    		'teeny' => true, 
    		'media_buttons' => true, 
    		'drag_drop_upload' => true, 
    		'quicktags' => array(
    		'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close'));	
    	
    	// get the editor	
    	wp_editor( $content, $editor_id, $settings );
    }
    add_action( 'activity_reply_textarea', 'bpfr_reply_tiny_editor' );

    However I can’t figure out how to add bp_activity_id() to the $editor_id or ‘textarea_name’ =>. So of course it only works on the first reply box. Any ideas on how I can fix this?

    Thanks


    danbp
    Moderator

    @danbp

    This snippet may work… (untested)

    function bpfr_reply_tiny_editor() {
    
    $editor_id = 'ac-input-'. bp_get_activity_id();
    $area_name = 'ac_input_'. bp_get_activity_id();
    
    	$settings = array( 
    		'textarea_name' => $area_name, 
    		'editor_class' => 'ac-input bp-suggestions', 
    		'media_buttons' => false, 
    		'teeny' => true,
    		'quicktags' => true 
    		);
    
    	wp_editor( $content, $editor_id, $settings );
    
    }
    add_action( 'activity_reply_textarea', 'bpfr_reply_tiny_editor' );


    @henrywright
    , any thought about this ? I’m really unsure with that 🙂


    bigkahunaburger
    Participant

    @bigkahunaburger

    @danbp THANKS! That got it working. I was trying to do that in the array without thinking. 😛


    danbp
    Moderator

    @danbp

    Glad you got it to work !

    I tested it right now, and must say that it doesn’t work correctly with twenty twelve. I can’t publish as i have no focus in the editor. But i have a lot of plugins and custom functions running. Maybe a JS conflict….


    bigkahunaburger
    Participant

    @bigkahunaburger

    @danbp I tested everything and it seems to be working. Did you change the entry.php?


    danbp
    Moderator

    @danbp

    Yep !


    bigkahunaburger
    Participant

    @bigkahunaburger

    @danbp I’m also using it in the main editor per your instructions on that other page. Not sure if that makes a difference.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add tinymce to Activity Post Reply Form’ is closed to new replies.
Skip to toolbar