• Resolved blazeking

    (@blazeking)


    The Credly Login plugin is causing me some trouble. It was working without issue, but now when the plugin is enabled, I receive the error:

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /var/www/html/wp-includes/functions.php on line 3547

    When the plugin is enabled, I receive the error above when debug mode is enabled. When attempting to log in via Credly, it appears to stop after submitting username/password.

    I’m running 4.1, but it happens with previous versions as well. Any help is appreciated, thanks!

    https://wordpress.org/plugins/credly-login/

    https://wordpress.org/plugins/badgeos/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    are these showing up when browsing frontend pages or WP admin pages? Trying to pinpoint where may be coming from based on that status.

    Thread Starter blazeking

    (@blazeking)

    The error message shows on all frontend pages and wp-admin pages.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Looks like I missed an important detail in that this is for the Credly Login plugin, and not BadgeOS core. My oops :D.

    Anyways, I don’t have the necessary access to fix this in the repo directly, so I forwarded over the following fix to the people who can. Until then, if you want to patch it yourself, replace line 32 and 33 from credly-login.php with the following:

    function credly_login_scripts() {
        wp_enqueue_script( 'credly-login-script', CREDLY_LOGIN_URL . 'assets/js/login.js', array( 'jquery' ) );
        wp_localize_script( 'credly-login-script', 'CredlyLogin', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
    }
    add_action( 'wp_enqueue_scripts', 'credly_login_scripts' );
    Thread Starter blazeking

    (@blazeking)

    I’ve replaced the code. However, now when clicking the “Log in with Credly” button, nothing happens. No pop-up.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Is the site live at all that I could check on some things at? Otherwise not sure what’s going on. Only thing I can think of is some sort of js error in your browser’s developer console.

    Thread Starter blazeking

    (@blazeking)

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    aha, I had the wrong hook.

    change wp_enqueue_scripts to login_enqueue_scripts

    Thread Starter blazeking

    (@blazeking)

    That was it! Thank you!!!

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

The topic ‘Credly Login plugin error – "wp_enqueue_script was called incorrectly"’ is closed to new replies.