WordPress.org

Ready to get started?Download WordPress

Forums

Post Thumbnail Editor
[resolved] pte not defined rror (26 posts)

  1. David Radovanovic
    Member
    Posted 2 years ago #

    After many happy months of using your fantastic plugin, it's failing with an error:

    pte is not defined
    [Break On This Error] 	
    
    jQuery(function(){ pte.editor(); });

    I assume it's another plugin that it's having a conflict with though the prospect of de-installing all the plugins just to have to reinstall and reconfigure is a daunting process. Any suggestions, since the problem exists in the admin?

    I can provide a screen capture for anyone interested in helping.

    Thanks!

    http://wordpress.org/extend/plugins/post-thumbnail-editor/

  2. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    This is caused by another plugin trying to load javascript where it shouldn't.

    I have seen problems with the WPML plugin, and sent a patch to the developers, but I haven't had any other plugins reported with problems (even though I know there are some out there).

    If you use google chrome, you can try opening the post thumbnail editor in it's own window (middle-click on the "thumbnail" option from the media library page) and turn on javascript debugging (F12). Hopefully this shows which plugin created a problem or injected javascript, then we can look for a solution.

  3. David Radovanovic
    Member
    Posted 2 years ago #

    sewpafly, thanks for the quick reply. Here is what appears in Chrome's Console after F12:

    admin-ajax.php:22Uncaught ReferenceError: pte is not defined
    (anonymous function)admin-ajax.php:22
    f.Callbacks.njquery.js:2
    f.Callbacks.o.fireWithjquery.js:2
    e.extend.readyjquery.js:2
    c.addEventListener.Bjquery.js:2
    Resource interpreted as Image but transferred with MIME type text/html: "http://www.chefsconsortium.com/wp-admin/admin-ajax.php?1679696872".

    Not sure it gives a clue to the offending plugin's javascript.

  4. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Yeah, the njquery thing looks funny... After you press F12, there is also a Script button at the top. There will be a dropdown of different scripts that get loaded. A typical PTE installation should load the following javascript:

    pte.full.js
    jquery.json-2.2.min.js
    jquery.imgareaselect.js
    jquery.js

    If there's something else hopefully we can track it down based on the filename and content.

  5. David Radovanovic
    Member
    Posted 2 years ago #

    .../wp-admin/admin-ajax.php?action=pte_ajax&pte-action=launch&id=12876&TB_iframe=true&width=640&height=699
    
    .../wp-admin/js/common.js?ver=20120102
    
    .../wp-admin/js/utils.js?ver=20101110
    
    .../wp-includes/js/hoverIntent.js?ver=20090102
    
    .../wp-includes/js/jquery/jquery.js?ver=1.7.1
  6. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    The one that's causing the problem is the top one (probably). Can you select that one and then copy/paste the code into a pastebin for me?

  7. David Radovanovic
    Member
    Posted 2 years ago #

    common.js -->

    http://pastebin.com/dVVFqe4X

    Thanks for your help!!

  8. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    I actually meant the other first one. :D It looks like the plugin is actually injecting it straight into the page, which is the problem, if you select the admin-ajax.php one you'll probably get a lot of html and javascript, but it might be worthwhile to see it.

    How familiar are you with grep and the command line?

  9. David Radovanovic
    Member
    Posted 2 years ago #

    Give me the command line and I'll run it...

  10. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Can you pastebin the PTE page's HTML?

  11. David Radovanovic
    Member
    Posted 2 years ago #

  12. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Assuming you are in wordpress/wp-content/plugins try running this: find * -iname '*.php' | xargs grep 'warnDelete'

  13. David Radovanovic
    Member
    Posted 2 years ago #

    [user@myserver plugins]$ find * -iname '*.php' | xargs grep 'warnDelete'
    [user@myserver plugins]$
  14. David Radovanovic
    Member
    Posted 2 years ago #

    Did I get the command right?

  15. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    That's the right command... Currently I don't understand where the call for pte.full.js is. It's missing. The only libraries that are added seem to be stock wordpress ones.

    warnDelete is called in script-loader.php

    Try this command:
    find * -iname '*.php' | xargs grep -li 'wp_default_scripts'

  16. David Radovanovic
    Member
    Posted 2 years ago #

    [user@myserver plugins]$ find * -iname '*.php' | xargs grep -li 'wp_default_scripts'
    [user@myserver plugins]$

    nothing

  17. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    What about this one: find * -iname '*.php' | xargs grep -li 'WP_Scripts'

  18. David Radovanovic
    Member
    Posted 2 years ago #

    [myserver plugins]$ find * -iname '*.php' | xargs grep -li 'WP_Scripts'
    gravityforms/form_display.php
    gravityforms/gravityforms.php
    wp-pagenavi/scb/Util.php
  19. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Can you try disabling the gravity forms plugin, then testing PTE again?

    Then repeat with the wp-pagenavi (I am not familiar with this one).

    If you can find which one (or both) causes the problem, I'll install those plugins and try to find a solution.

  20. David Radovanovic
    Member
    Posted 2 years ago #

    it was the gravity forms Version 1.6.3.3.2

  21. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Because the plugin is closed source and I can't appear to post on the forums, can you submit a bug report? I'm not sure if they will respond, but I am willing to work with their team to get the issue resolved.

    If you want to take a crack at fixing their code, the fix could be pretty simple, you can grep through their code to find where they initialize their java code (it's in some wordpress hook) and then if defined('DOING_AJAX') is set they shouldn't run their stuff.

  22. David Radovanovic
    Member
    Posted 2 years ago #

    I posted a bug report. We'll see if a response follows. I hate to deactivate Gravity Forms though your plugin is essential. Thanks for your generous support.

  23. David Radovanovic
    Member
    Posted 2 years ago #

    sewpafly-

    You think there's a simple way to wp_dequeue_script gravity scripts on the post thumbnail editor page?

  24. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Without looking at the code, I couldn't say for certain. However my initial feeling is no, there isn't an easy way to dequeue any other plugins scripts with the current method that pte uses. 

  25. David Radovanovic
    Member
    Posted 2 years ago #

    Sewpafly,

    So the problem was with the way Gravity Forms installation was configured. As quoted by Alex of Gravity Forms support (very responsive);

    ".... Your instance of Gravity Forms was running with "No-conflict" enabled. When that is enabled, Gravity Forms prevents scripts from being enqueued on certain areas of the site. The purpose of this feature is to reduce conflicts on the Gravity Forms pages, but apparently there is a glitch in this feature that disables scripts from the admin-ajax.php file. I will be looking into that, but I disabled the "No-conflict" mode on your site and the post thumbnail editor seems to be back to normal."

    Thanks for your great support.

  26. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Great news. Thanks for updating the thread!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic