How to disable html in comments and every where?

How to disable html in comments and every where? is there is any way to disable html using in comments

  • May be you could extend the 'post comment action' to parse all html and post it as text. Somehow you will have to filter all html tags. I don't know if you could somehow change HTMLAWLED to do that.

    Rodolfo Hernandez

    Arvixe/Elgg Community Liaison

  • I think he is asking about disabling tinymce in comment section..

    for that you need to edit the add.php file in views/default/forms/comments and change the line

    input/longtext to input/plaintext

    its better if you extend the add.php to your theme..

  • Please don't edit core files. As Satheesh said, you will want to override the forms/comments/add view.

    You also need to strip tags on the server-side. The easiest way I can think of is this in your plugin:

    function myPlugin_before_comment($h, $t, $r, $p) {
        $comment = strip_tags(get_input('generic_comment'));
        set_input('generic_comment', $comment);
        return true;
    }
    elgg_register_plugin_hook_handler('action', 'comments/add', 'myPlugin_before_comment'); 
  • @Steve Clay

    Cool, I was kinda lost there. Didn't know if you had to extend the action or the 'add' view. Thanks for this.

    Rodolfo Hernandez

    Arvixe/Elgg Community Liaison

  • Hannibal Smith

    Steve Clay i wan't that no one can post any of html in comments is that possible to stop members to add html in comments, i also disabled tinymc but it still alow to post html in comments.

  • @Hannibal, the code I posted strips all HTML tags on input. Elgg will re-add some P and BR tags in order to display line and paragraph breaks properly.