Web Invoice interferes with TinyMCE

Wordpress Logo

Plugin By S H Mohanjith (Zinglix)

Plugin Home

  • WordPress Version: 3.1.2
  • Plugin Version: 2.1.0

Issue

http://wordpress.org/support/topic/plugin-web-invoice-problem-with-tinymce-after-enabling-this-plugin

When the Web Invoice plugin is installed the hyperlink functionality in TinyMCE stops working.

Resolution

Download

For Version 2.1.0: web-invoice.zip

Simply replace the web-invoice.php file in your Web Invoice wordpress plugin folder with this one and you will no longer have an issue (until the plugin is updated, which will write over the changes).

Method

Stop the plugin from loading it’s own javascript and jQuery plugins unless it’s actually on a Web Invoice admin (Option) page by following http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_scripts_only_on_plugin_pages.

  1. I commented out a section from the init() function inside the if(is_admin()) part so it looks like the following:[sourcecode language=’php’]
    if (is_admin())
    {
    if (is_multisite() && !get_option(‘web_invoice_installed’, false)) {
    $this->install();
    }
    /*
    wp_enqueue_script(‘jquery’);
    wp_enqueue_script(‘jquery-ui-core’);
    wp_enqueue_script(‘jquery-ui-tabs’);
    wp_enqueue_script(‘jquery-maskedinput’,$this->uri.”/js/jquery.maskedinput.js”, array(‘jquery’));
    wp_enqueue_script(‘jquery-cookie’,$this->uri.”/js/jquery.cookie.js”, array(‘jquery’));
    wp_enqueue_script(‘jquery-form’,$this->uri.”/js/jquery.form.js”, array(‘jquery’) );
    wp_enqueue_script(‘jquery-impromptu’,$this->uri.”/js/jquery-impromptu.1.7.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘jquery-field’,$this->uri.”/js/jquery.field.min.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘jquery-delegate’,$this->uri.”/js/jquery.delegate.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘jquery-calculation’,$this->uri.”/js/jquery.calculation.min.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘jquery-tablesorter’,$this->uri.”/js/jquery.tablesorter.min.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘jquery-autogrow-textarea’,$this->uri.”/js/jquery.autogrow-textarea.js”, array(‘jquery’), ‘1.8.0’);
    wp_enqueue_script(‘web-invoice’,$this->uri.”/js/web-invoice.js”, array(‘jquery’, ‘jquery-ui-core’, ‘jquery-ui-tabs’), WEB_INVOICE_VERSION_NUM, true);
    */
    }
    [/sourcecode]
  2. Then I modified the web_invoice_add_pages() and admin_head() function in the following way:[sourcecode language=’php’]
    function admin_head()
    {
    //echo “