WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] Bug: disables Quick Edit. (23 posts)

  1. Mugsy
    Member
    Posted 2 years ago #

    It was driving me crazy trying to figure out why "Quick Edit" suddenly stopped working on me until I discovered that I needed to disable this plugin.

    I'm not sure why, but I haven't been able to change the Post-date to Schedule a post to appear at a specific time, ever since WP2.0. My work-around has been to go to the List of All Posts and click "Quick Edit" to change the time/date before submitting.

    With "Google Libraries" installed, when I click on "Quick Edit", the post vanishes from the list (Refreshing the screen brings it back). Only temporarily disabling Google Libraries prevents this from happening. Very annoying.

    Otherwise, the plugin appears to work fine.

    http://wordpress.org/extend/plugins/use-google-libraries/

  2. defunctlife
    Member
    Posted 2 years ago #

    I noticed it breaks a number of plugins in wp-admin as well. It also breaks the main dashboard page, you can no longer manage those widgets.

    Anyone have a fix besides using the included jquery with wordpress?

  3. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    I can't reproduce, so chances are it's some other plugin mis-enquing a script (before init). I'm pretty sure that starting with WP 3.3 there should be a message logged when plugins do this and WP_DEBUG is enabled.

    I don't have the widget problem either.

    If either of you want to give me a list of plugins, or more specific instructions to reproduce I'll see what I can do.

  4. defunctlife
    Member
    Posted 2 years ago #

    Hey Jason,

    I'm using 3.1.2 and sadly we are using about 40 plugins. I'll debug and get back to you regarding which one is causing the issue. Also, this is a WPMU install, not sure if that has anything to do with it.

    Get back to you soon.

    Thanks

  5. defunctlife
    Member
    Posted 2 years ago #

    Hey again Jason,

    You were right, it is another plugin causing the problem, specifically BWP minify ( http://wordpress.org/extend/plugins/bwp-minify/ )

    When using both your plugins together, it creates this in the footer source, the 1.8.9 happens to be the jquery UI version:

    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://xxx.com?ver=1.8.9'></script>

    Let me know if I can provide anything else and thank you.

  6. defunctlife
    Member
    Posted 2 years ago #

    Hey Jason,

    I was able to hack this to work, but it's not really the most ideal solution. If you have any ideas, let me know:

    in use-google-libraries.php:

    $ig = false;
    
          foreach ($newscripts as $script) {
            $olddata = $this->WP_Dependency_get_data($scripts, $script->handle);
          	$scripts->remove( $script->handle );
          	// re-register with original ver
            // hack: only allow it to enque one jquery-ui, which has version of 1.8.9
            if(!$ig)
          	 $scripts->add($script->handle, $script->src, $script->deps, $script->ver);
            if( $script->ver == '1.8.9' && !is_admin())
              $ig = true;
    
            if ($olddata)
              foreach ($olddata as $data_name => $data) {
                $scripts->add_data($script->handle,$data_name,$data);
              }
          }
  7. Mugsy
    Member
    Posted 2 years ago #

    I went through and tried disabling every other Plugin, but nothing stopped the aforementioned bug (clicking 'Quick Edit' results in entry disappearing from the list of Posts] from recurring. ONLY disabling "Use Google Libraries" allows me to access "Quick Edit" normally.

    Problem exists in both Firefox AND MSIE-9, so it is not a browser issue. I will try another OS (currently using 64bit Win7), but I expect the same result.

    (UPDATE: Tried Linux. No difference.)

  8. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    defunctlife: I'm curious why you have multiple jquery-ui's enqueued with different versions. That seems a likely to be the root of your problem.

    'Use Google Libraries' doesn't touch the version. It just takes what WordPress gives it (which is how this plugin usually works fine without any modification between WordPress releases).

    Mugsy: I can't reproduce the problem. With UGL as the ONLY plugin enabled, and your cache cleared out, you still see the issue? What theme are you using?

  9. defunctlife
    Member
    Posted 2 years ago #

    Hi Jason,

    I don't think I do, I would be happy to send you any further debug information. If I just use "use google libraries" alone, it only loads 1 very jquery, enabling BWP minify seems to interfere with that and cause it to load like 9 times. I'm not exactly sure where the problem lies...

  10. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    I'll take a look and see if I can reproduce by adding BWP to my test setup.

  11. defunctlife
    Member
    Posted 2 years ago #

    I have this in my functions.php, maybe it helps:

    wp_enqueue_script('jquery', '', '', '', true);
    	wp_enqueue_script('jquery-ui-core', '', '', '', true);
    	wp_enqueue_script('jquery-ui-tabs', '', '', '', true);
    	wp_enqueue_script('jquery-ui-resizable', '', '', '', true);
    	wp_enqueue_script('jquery-ui-draggable', '', '', '', true);
    	wp_enqueue_script('jquery-ui-selectable', '', '', '', true);
        wp_enqueue_script('jquery-ui-dialog');
  12. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Wait, where in your functions.php? Is it in an init hook? If not you've probably corrupted the script loader (starting with 3.3 this should be caught when WP_DEBUG is enabled). Also, when enqueueing previously registered scripts, you only do this (or things break):

    wp_enqueue_script('name')

    In this case what you want is:

    function my_init() {
      wp_enqueue_script('jquery-ui-tabs');
      wp_enqueue_script('jquery-ui-dialog');
      wp_enqueue_script('jquery-ui-draggable');
      // the other scripts you had listed are prerequisites, so just let
      // them load
    }
    add_action('init','my_init');
  13. defunctlife
    Member
    Posted 2 years ago #

    No dice :(

    Here is my full function, tried making your adjustments: http://pastie.org/2977611

  14. Mugsy
    Member
    Posted 2 years ago #

    Thanks for the reply Jason.

    Not sure how to flush the WP cache. I've tried disabling every plugin except UGL, and even tried switching to the default WP Theme instead of my own (which only alters the front-end), and it made no difference.

  15. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Mugsy, I actually meant after disabling the plugin be sure to clear your browser cache. If you have FireBug installed in FireFox you could see if you get any errors in the console.

  16. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    I just released a new version (1.2). It changes how UGL handles cases where multiple smaller scripts are merged into a single script on Google's servers (which was breaking things with the WordPress 3.3 RC, because jQuery UI's dependency structure is quite different).

    I'm not sure if will effect either of these issues, but could you give it a try and let me know?

  17. defunctlife
    Member
    Posted 2 years ago #

    Updated and no change for me, still adding a bunch of these at the bottom of my script, if you want to speed this up I can give you access to have a look to make troubleshooting faster:

    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>
  18. defunctlife
    Member
    Posted 2 years ago #

    Well, I got it working.

    I removed these completely from my functions.php:

    wp_enqueue_script('jquery', '', '', '', true);
    	wp_enqueue_script('jquery-ui-core', '', '', '', true);
    	wp_enqueue_script('jquery-ui-tabs', '', '', '', true);
    	wp_enqueue_script('jquery-ui-resizable', '', '', '', true);
    	wp_enqueue_script('jquery-ui-draggable', '', '', '', true);
    	wp_enqueue_script('jquery-ui-selectable', '', '', '', true);
        wp_enqueue_script('jquery-ui-dialog');

    does that mean something is trying to enqueue this more than once? I always had 7 of these:

    <script type='text/javascript' src='http://mydomain.com?ver=1.8.9'></script>

    which matches how many scripts I was trying to enqueue there.

    Thank you very kindly for your help Jason, it is much appreciated. Any chance you know why this was happening for my understanding?

  19. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Essentially you were mis-using wp_enqueue_script in such a way that you broke things. There are two ways to use wp_enqueue_script. The main way is just:

    wp_enqueue_script('handle');

    The other way is to pass all the arguments you would normally pass to wp_register_script. This is for single use scripts that don't need to be registered separately. It is not for enqueueing already registered scripts.

    So to explain:

    wp_enqueue_script('jquery', '', '', '', true);

    That says: register a new script with the handle 'jquery', with no source url, no dependencies, no version, in the footer, then enqueue it, which judging from the URLs you ended up with, it mostly worked, but I don't think it's what you wanted.

    I'm guessing you are trying to force scripts that WordPress registers as header loading to instead load in the footer. Don't do that. Even if it did what you wanted, core WordPress doesn't work if you do that.

    Hope that helps!

  20. Mugsy
    Member
    Posted 2 years ago #

    Hi Jason,

    Unfortunately, the updated UGL didn't solve my issue (I'm using WP3.2.1) and I haven't added any scripting of my own the way "defunctlife" has, so I'm not sure what is happening on my end.

    Re: My browser cache... I disabled it when I moved to a SSD to reduce writes to my SSD, but even before I added my SSD two weeks ago, I was still having the problem, so I know that's not it. The issue is definitely on the Server-side of things.

    I configured my host ("1and1") last year to use PHP5 and SQL5, if that makes any difference?

    I don't know enough about how the "Quick Edit" link works normally to figure out what UGL is doing different, and at this point, I haven't noticed any other commands not working, so it is all very odd.

  21. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Mugsy,

    Other than changing where scripts are enqueued from, UGL does it's very best to do nothing else. Unfortunately other plugins often do things like unregister core scripts and replace them, or register scripts with the wrong dependencies. With the exception of the issue I fixed in 1.2, there have been no issues found in UGL like the one you are reporting where some other plugin or theme wasn't doing something incorrectly. If you've found one, I want to know so I can fix it, but I don't have anything to go on.

    If you can run a browser with a javascript console (life Firefox with FireBug enabled) and tell me if you see any errors on page load and/or any new ones when you hit Quick Edit that would be a big help. Also check and make sure the scripts are actually loading or being blocked for some reason (the FireBug 'Net' tab can tell you this). If a javascript file doesn't actually load you won't know about it (other than possibly things not working on the site).

    If you want to give me access to your site to take a look you can use the contact form here: http://jasonpenney.net/contact/

    Jay

  22. defunctlife
    Member
    Posted 2 years ago #

    Hey Jay,

    Spot on here, I was trying to force them to the footer.

    Thanks again for spending the time.

  23. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Mugsy,

    Taking a look at the source of the plugins on your site, I see the following potential issues:

    flv-embed: This plugin does not use the script loader, but prints directly to the header (even worse it's printing to the header a script that WordPress's script loader already supports).

    lightbox-2: This plugin calls wp_enqueue_script outside of an action, which is not supported according to WordPress docs, and it's known to break UGL.

    pretty-comments: this plugin in registering scripts and enqueueing them during 'wp_print_scripts', which is too late according to the WordPress docs.

    Both litebox-2 and pretty-comments are doing things that WordPress codex calls out will break things:

    This function will not work if it is called from a wp_head or wp_print_scripts actions, as the files need to be enqueued before those actions are run. See the Usage section for the correct hooks to use.

    That's my guess as to what's going on, although looking at the net console n FireBug I also see it trying to load a script from a URL that doesn't exist. I'm not sure what's doing that, but it's probably not helping.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic