Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove or suppress rich text / TinyMCE ability in text areas


  • @mcuk
    Participant

    @mcuk

    I’ve seen a few posts on removing the ability of site users to use the rich text editor (tinymce) that was introduced in update BP 2.4 (i think). But not seen any solutions.

    I encounter it in the Profile Fields with the ‘multi line text area’ setting. Is it possible to remove/suppress it entirely, or failing that, for individual fields as needed?

    Thanks

    BP. 2.4.2
    WP. 4.4

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

  • @mcuk
    Participant

    @mcuk

    After a lot of searching I’ve put this together. It appears to remove the ability of normal site users to use the rich text area editor in ‘multi line text areas’. Its use now allows jQuery functions for character limits to be applied to the text area which was not possible when tinymce was active.

    function bptest_remove_tinymce() {
    	if ( !is_super_admin() ) {
    	tinymce.activeEditor.getBody().setAttribute( 'contenteditable', false );
    	}
    }
    add_action( 'wp_footer', 'bptest_remove_tinymce' );

    Note that the is_super_admin() is included. Without it the WP bar at the top of the screen which is used to access dashboard etc disappears.

    Then to remove the remaining Visual/Text tabs attached to the text area, use the CSS display:none on the relevant div id.

    I am still very curious as to whether there are better methods for excluding the rich text editor / tinymce from Buddypress (across the site and/or targeting specific text areas). Would appreciate any input from anyone more in the know!

    Thanks


    danbp
    Participant

    @danbp

    Hi,

    best solution is to use the built-in filter, instead of modifying tinymce which may affect all editors.

    I provided a working example here:
    https://buddypress.org/support/topic/suppressing-rich-text-on-xprofile-text-area/#post-247640


    @mcuk
    Participant

    @mcuk

    Great! Thanks @danbp

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove or suppress rich text / TinyMCE ability in text areas’ is closed to new replies.
Skip to toolbar