• Resolved choufourax

    (@choufourax)


    The secure login widget does not work for me with “AAM requires jQuery library in order for login widget to work” message in console log.

    I use a very clean theme that call all js in footer, so Jquery is called in my web site, but after your :
    <script src=”/app/plugins/advanced-access-manager/media/js/aam-login.js?ver=4.9.4″></script>
    – Who is in the header.

    I think you can avoid this problem by calling your js via the wordpress function wp_enqueue_script
    This would be a good practice and give more compatibility to your awesome plugin

    I have no problem with the JS of other plugins.

    Thanks

Viewing 1 replies (of 1 total)
  • For me this has to do with the order in which the scripts are loaded. Their javascript is loaded via wp_enqueue_script.

    In application/frontend/manager.php [line: 105] there is :

    wp_enqueue_script('aam-login', AAM_MEDIA . '/js/aam-login.js');

    If I change this to:

    wp_enqueue_script('aam-login', AAM_MEDIA . '/js/aam-login.js', ['jquery']);

    It works.

    What you could do is remove the script with wp_dequeue_script and then re-enqueue it in your functions.php or elsewhere, passing jquery as a pre-requisite, as seen in the second code example above. You would have to change AAM_MEDIA to a relative or absolute path to the plugin directory.

    **Edit**

    I just implemented it for my site. You want to do something similar to the following. I’m using bedrock by roots.io for a theme, so my directory structure is a bit different than standard wordpress.

    add_action('wp_enqueue_scripts', function(){
        wp_dequeue_script('aam-login');
        wp_enqueue_script('aam-login', get_home_url() . '/app/plugins/advanced-access-manager/media/js/aam-login.js', ['jquery']);
    });
    • This reply was modified 8 years, 3 months ago by jgarib.
Viewing 1 replies (of 1 total)

The topic ‘Jquery missing in aam secure login widget’ is closed to new replies.