BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53194

    Oh wow, I was going to make another support ticket regarding my editor not working (unclickable content area) in Mozilla browser. Behold, it started working when I applied your solution!

  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53193

    Hi Brajesh,

    Thank you for your suggestion! I applied the wp_editor_settings filter, and it worked perfectly, providing an even cleaner solution. I appreciate your help in pointing me in the right direction.

    Best regards,

    Azra

  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53112

    Hi, I ended up using this code for my problem. It appears to be working. I’ll leave this here for future people who may have the same problems.

    function disable_html_editor_on_frontend() {
        if (!is_admin()) {
            add_filter('user_can_richedit', '__return_true'); // Force enable rich editing
    	add_action('wp_footer', 'remove_html_editor_button', 20);
    
        }
    }
    add_action('wp_enqueue_scripts', 'disable_html_editor_on_frontend');
    
    function remove_html_editor_button() {
     ?>
        <script>
            document.addEventListener('DOMContentLoaded', function() {
                // Hide the "Tekst" (HTML) editor button
                var htmlEditorButton = document.getElementById('bbl_post_content-html');
                if (htmlEditorButton) {
                    htmlEditorButton.style.display = 'none';
                }
    
                // Ensure the Visual editor is active
                var visualEditorButton = document.getElementById('bbl_post_content-tmce');
                if (visualEditorButton && !visualEditorButton.classList.contains('active')) {
                    visualEditorButton.click();
                }
    
                // Prevent any click event on the HTML editor button if it's still accessible somehow
                if (htmlEditorButton) {
                    htmlEditorButton.addEventListener('click', function(e) {
                        e.preventDefault(); // Prevent switching to HTML mode
                    });
                }
            });
        </script>
        <?php
    }
  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53109

    The best solution for me would be to completely turn off the HTML editor option, and only allow visual editor.

  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53108

    Hi, thank you for your reply. I just tried the approach of turning off all other plugins and changing theme, again. It didn’t help unfortunately. Is there anything more I can try?

  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53105

    Additional info: for some very odd reason, It works on Chrome for some users when i add this to my functions.php, although rich_editing user meta is already TRUE for all users.

    function reset_editor_preference() {
        $user_id = get_current_user_id();
        update_user_meta($user_id, 'rich_editing', 'true');
    }
    add_action('init', 'reset_editor_preference');
  • Participant
    Level: Initiated
    Posts: 7
    Azra Kadrić on #53104

    Related buddyblog form: https://prnt.sc/6ulNcmHrsRjc