Support » Plugin: WP-UserOnline » Enqueue js file

  • Hi Lester,

    static function scripts() {
    		if ( !self::$add_script )
    		$js_dev = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
    		//wp_enqueue_script( 'wp-useronline', plugins_url( "useronline$js_dev.js", __FILE__ ), array( 'jquery' ), '2.80', true );
    		wp_enqueue_script( 'wp-useronline', "/assets/forums/js/useronline$js_dev.js", array( 'jquery' ), '', true );
    		wp_localize_script( 'wp-useronline', 'useronlineL10n', array(
    			'ajax_url' => admin_url( 'admin-ajax.php' ),
    			'timeout' => self::$options->timeout * 1000
    		) );

    as you can see I had to move the js file in my template directory to avoid an Internal server error 500. Have you already thought of another way, different from my example to avoid this error?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lester Chan


    Check your PHP error logs to know what is the exact error? I am guessing it might be a theme or plugin conflict on your end.

    You can try a fresh install of WP with just this plugin.

    Yes, even I thought,
    but the board is debug_true and no error in debugging in log files.
    Apparently everything seems ok.
    I do other checks…

    you might think to hide the inclusion of js files from the footer?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enqueue js file’ is closed to new replies.