• Resolved professor99

    (@professor99)


    WordPress: Version 3.4.2
    WP User Frontend: Version 1.1
    Browser: Firefox 16.0.2

    Problem

    When I click on the “Insert/Edit Link” button in the editor window (TinyMCE) in my “Edit Post” Page (using [wpuf_edit] shortcode) all I get is the grey transparent overlay and no “Insert/edit link” dialog window.

    This works fine from the Admin Posts page which uses the default admin editor code.

    Cause

    Using Firebug Console I found an error was being thrown in the JQuery UI core file (jquery.ui.core.js) as follows

    “TypeError: d is undefined”

    Now this is very undescriptive as this file on WordPress is a minimized version with pretty much anything descriptive stripped out.

    File: wp-includes\js\jquery\ui\jquery.ui.core.min.js
    Version: jQuery UI – v1.8.20 – 2012-04-30

    On substituting the latest JQuery 1.8 stable release (v1.8.24) of the unminimized version of this file I found that the link dialog suddenly appeared.

    On checking the update history of this file I found this addition

    // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
    if ( !$.curCSS ) {
    	$.curCSS = $.css;
    }

    and sure enough with this commented out the problem reappears.

    Solution

    I can see maybe three solutions:

    1. Substitute wp-includes\js\jquery\ui\jquery.ui.core.min.js with the
    newer version v1.8.24 from https://github.com/jquery/jquery-ui/blob/1-8-stable/ui/jquery.ui.core.js

    This doesnt unfortunately allow for an update to the WP User Frontend package to fix this.

    2. Work out a code fix for WP User Frontend. Since this works for the standard admin editor this gives a starting point to work out such a solution.

    3. Use a older version of WordPress (version?) or wait for a newer version of WordPress that includes an updated JQuery UI.

    Cheers
    The Professor

    https://www.ads-software.com/extend/plugins/wp-user-frontend/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter professor99

    (@professor99)

    Update1

    Checked the admin editor load and found it was executing the following jquery file

    file: wp-includes/js/jquery/jquery.js?
    version: 1.7.2

    In this file there is the following line which is executed on editor load.

    f.curCSS=f.css

    In the unminified version of this file this reads as

    // DEPRECATED in 1.3, Use jQuery.css() instead
    jQuery.curCSS = jQuery.css;

    Commenting this out produces the same behaviour as the WP User Frontend exhibits on clicking the link button.

    Found WP User Frontend wasn’t using this JQuery file at all. Instead it uses

    https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js?ver=3.4.2

    which is JQuery version 1.8 which doesnt include “jQuery.curCSS = jQuery.css;” and hence the problem.

    So the real problem is why is WP User Frontend using the googleapis version and not the local wp-includes version? Which should it be using?

    TheProfessor

    Thread Starter professor99

    (@professor99)

    Resolution

    Upon further investigations I found that https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js?ver=3.4.2 was been loaded but another plugin (showtime) using the following script.

    function showtime_jQuery_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    //add_action('wp_enqueue_scripts', 'showtime_jQuery_method');

    It seems according to this link https://www.ads-software.com/support/topic/notice-wp_deregister_script-was-called-incorrectly plugins like to fix their JQuery version using such code.

    Unfortunately using JQuery 1.8 will break WordPress 3.4.2 as seen here.

    Solutions

    Presently I have four solutions for this problem.

    1. Change the JQuery version to 1.7.2 on the offending plugin (or alternatively comment the offending code out as I did which then causes it to default to the current wordpress JQuery version). In this case the Showtime Plugin seems to be quite happy with JQuery 1.7.2. If the given plugin absolutely requires the specified JQuery version try one of the following.

    2. Use my original fix which was to substitute wp-includes\js\jquery\ui\jquery.ui.core.min.js with the newer version v1.8.24 from https://github.com/jquery/jquery-ui/blob/1-8-stable/ui/jquery.ui.core.js

    3. Insert the code jQuery.curCSS = jQuery.css; where appropriate

    4. Wait for a newer version of WordPress that includes an updated JQuery UI.

    Conclusion

    My investigtions also hint there maybe maybe other side effects of this bug depending on code.

    In conclusion this and maybe other bugs in WP User Frontend may be caused by other plugins that use JQuery version substitution.

    So before one reports a WP User Frontend bug one needs to disable other plugins to see if they are the cause.

    Hope this helps other people who come across this hard to resolve bug.

    Cheers
    The Professor

    Thread Starter professor99

    (@professor99)

    Slight correction and additional info

    The original script at the top of the last post should be

    Original

    function showtime_jQuery_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'showtime_jQuery_method');

    To fix the offending plugin if it is compatible with JQuery version 1.7.2 alter the plugin code appropriately using one of the following options as a template

    Option 1.

    function showtime_jQuery_method() {
    //    wp_deregister_script( 'jquery' );
    //    wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'showtime_jQuery_method');

    Option 2

    function showtime_jQuery_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'showtime_jQuery_method');

    Cheers
    The Professor

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Insert/edit Link Dialog doesnt show’ is closed to new replies.