BuddyDev

Search

[Resolved] BuddyPress Private Messaging – disable addition of image

  • Participant
    Level: Master
    Posts: 279
    NikB on #27800

    BuddyPress seems to use the filter bp_nouveau_messages_mce_buttons to remove some of the formatting from the standard TinyMce which is great, but the same filter also adds the option to add an image to the message ie.

    // Add the image button
    array_push( $buttons, ‘image’ );

    … which I want to remove.

    I can’t for the life of me figure out how to override this filter in my child theme and would be very grateful for any suggestions.

    With many thanks in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #27892

    Hi Nick,
    Please use the following code.

    
    
    /**
     * Remove image button from the BP Nouveau template's compose message.
     */
    add_filter( 'mce_buttons', function ( $buttons ) {
    
    	// make sure this is for the message.
    	if ( ! has_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons' ) ) {
    		return $buttons;
    	}
    
    	return array_diff( $buttons, array( 'image' ) );
    
    }, 20 );
    
    

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 279
    NikB on #27895

    Brajesh you are a star! Thank you so much…

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #27896

    You are welcome 🙂

The topic ‘ [Resolved] BuddyPress Private Messaging – disable addition of image’ is closed to new replies.

This topic is: resolved