Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi Ansel,

    Can you try adding this:

    if( !wp_script_is('jquery')) {
    	$this->reloadScript();
    }

    after this:

    function print_admin_css()
    {

    like:

    function print_admin_css()
    {
        if( !wp_script_is('jquery')) {
    	$this->reloadScript();
          }

    in ag-custom-admin/plugin.php

    If this solves the problem, it will be included already in next version. You could check if there is a jquery script (‘/wp-includes/js/jquery/jquery.js’) included in document afert that.

    Thanks for reporting.

    Thread Starter Ansel Taft

    (@anseltaft)

    I included it before and after the rest of the code in the bracket and it made no difference:

    function print_admin_css()
    {
    if( !wp_script_is(‘jquery’)) {
    $this->reloadScript();
    }
    $this->agca_get_includes();
    $this->admin_capabilities();
    $this->context = “admin”;
    get_currentuserinfo() ;
    $wpversion = $this->get_wp_version();

    jQuery did not appear after that either. What could we try next?

    Thread Starter Ansel Taft

    (@anseltaft)

    Argonius,

    Here’s something we just discovered that should aid in troubleshooting:

    The issue described above only occurs on multi-sites. 1.2.6.5 works fine with the standalone sites.

    Thread Starter Ansel Taft

    (@anseltaft)

    Crap, scratch that… it’s hiccuping with one of the standalone sites so that’s not necessarily true. Sorry.

    Hi Anseltaft,

    You could try to take a look at the browser’s console for the possible errors. Also try disabling all other plugins for testing, because it might have conflict with some other plugin. AGCA supports multi-sites, so that shouldn’t be an issue. I need to take a look at the page source code to tell you what is going on exactly.

    Thread Starter Ansel Taft

    (@anseltaft)

    After deactivating all plugins, one then another, I can confirm that there’s an issue with the latest version of Formidable, version 1.06.05.
    http://formidablepro.com/

    How do you normally proceed from here?

    Nice catch. I see it’s not free, so you might ask their support to help you, or send me a source code of the problematic page to info[(at)]argonius.com to take a look. Be sure that there are no errors in browser’s console.

    Thread Starter Ansel Taft

    (@anseltaft)

    Reported to Sector 11, the makers of Formidable. I also sent you an email with the source code from our development server.

    Thank you for your support. 🙂

    @argonius, can you please update the way you are loading javascripts? In WordPress, you must use wp_enqueue_script to minimize conflicts.
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Hi Anseltaft,

    It’s true, jQuery script is not loaded. It does not appear in the login page that you sent to me.

    Try adding

    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
    wp_enqueue_script( 'jquery' );

    after

    function print_login_head(){

    and

    function print_admin_css(){

    just to test if this works. AGCA checks with wp_script_is(‘jquery’) if jQuery script is loaded or not, and this WordPress function returns TRUE, like the script was loaded, but actually is not. That’s really strange to me.

    You could also try to test if you can remove that check from both print_login_head and print_admin_css functions, so instead of this:

    if( !wp_script_is('jquery')) {
      $this->reloadScript();
    }

    add this:

    $this->reloadScript();

    @sswells. I agree with you, this should be improved. However, I’m really puzzled why this condition does not work it this case:

    if( !wp_script_is('jquery'))
    (ag-custom-admin/plugin.php line 1258)

    jQuery script is not loaded, and does not appear anywhere in code, but WordPress returns TRUE.

    jQuery plugins are loaded into the page, but not jQuery itself:

    /wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.8.20/
    /wp-includes/js/jquery/ui/jquery.ui.widget.min.js?ver=1.8.20
    etc..

    Is it possible that wp_script_is(‘jquery’) checks for those plugins instead, and thinks that jQuery is loaded?

    Thread Starter Ansel Taft

    (@anseltaft)

    Argonius,

    The first suggestion did not work for me, but the second one did. The login dialogue loaded when I changed

    function print_login_head(){
    		$this->context = "login";
    		if( !wp_script_is('jquery')) {
    			$this->reloadScript();
    		}
    		$this->agca_get_includes();
    		$wpversion = $this->get_wp_version();

    to

    function print_login_head(){
    		$this->context = "login";
    		$this->reloadScript();
    		$this->agca_get_includes();
    		$wpversion = $this->get_wp_version();

    jQuery loaded and all was well and right again in the world. 🙂

    I just did a quick search for the enqueue script functions, but did not dig into it. I’ve never used wp_script_is since wp_enqueue_script handles this. Also, please don’t register a different version of jQuery. This is also asking for lots of trouble since other plugins and themes may not test against the specific version you are forcing.

    Thread Starter Ansel Taft

    (@anseltaft)

    …please don’t register a different version of jQuery. This is also asking for lots of trouble since other plugins and themes may not test against the specific version you are forcing.

    I concur, based on the strong warnings and repetition voiced at the all the WordCamps I’ve attended.

    @anseltaft

    Thanks for the update, and donation. I’m glad it works. This needs to be improved and tested with the idea that sswells proposed in order to be included in the next version of plugin. I would recommend you to create some test environment with both plugins and to test the new AGCA version before updating it in production.

    @sswells

    Thanks for the idea, I will most likely use wp_enqueue_script instead in next version, after doing some research and testing.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘1.2.6.5 Does Not Load jQuery on the Admin Menu’ is closed to new replies.